forked from mirrors/nixpkgs
Merge pull request #103717 from WilliButz/codimd/add-package-option
nixos/codimd: add package option, refactor prettyJSON
This commit is contained in:
commit
9fc484c373
|
@ -6,8 +6,10 @@ let
|
|||
cfg = config.services.codimd;
|
||||
|
||||
prettyJSON = conf:
|
||||
pkgs.runCommand "codimd-config.json" { preferLocalBuild = true; } ''
|
||||
echo '${builtins.toJSON conf}' | ${pkgs.jq}/bin/jq \
|
||||
pkgs.runCommandLocal "codimd-config.json" {
|
||||
nativeBuildInputs = [ pkgs.jq ];
|
||||
} ''
|
||||
echo '${builtins.toJSON conf}' | jq \
|
||||
'{production:del(.[]|nulls)|del(.[][]?|nulls)}' > $out
|
||||
'';
|
||||
in
|
||||
|
@ -878,7 +880,6 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
environmentFile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
|
@ -908,6 +909,14 @@ in
|
|||
<literal>CodiMD</literal> is running.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.codimd;
|
||||
description = ''
|
||||
Package that provides CodiMD.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -938,7 +947,7 @@ in
|
|||
'';
|
||||
serviceConfig = {
|
||||
WorkingDirectory = cfg.workDir;
|
||||
ExecStart = "${pkgs.codimd}/bin/codimd";
|
||||
ExecStart = "${cfg.package}/bin/codimd";
|
||||
EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ];
|
||||
Environment = [
|
||||
"CMD_CONFIG_FILE=${cfg.workDir}/config.json"
|
||||
|
|
Loading…
Reference in a new issue