[nix] nixosModule: add testRun option

This commit is contained in:
2023-11-01 11:03:33 +01:00
parent b0723ae708
commit 5818349d91

View File

@@ -3,6 +3,7 @@ let
cfg = config.services.gokill; cfg = config.services.gokill;
configFile = pkgs.writeText "config.json" (builtins.toJSON cfg.triggers); configFile = pkgs.writeText "config.json" (builtins.toJSON cfg.triggers);
gokill-pkg = self.packages.x86_64-linux.gokill; gokill-pkg = self.packages.x86_64-linux.gokill;
testRun = if cfg.testRun then "-t" else "";
in in
{ {
options = with lib; { options = with lib; {
@@ -15,6 +16,14 @@ in
''; '';
}; };
testRun = mkOption {
default = false;
type = types.bool;
description = mdDoc ''
When set to true gokill is performing a test run
'';
};
triggers = mkOption { triggers = mkOption {
description = "list of triggers"; description = "list of triggers";
default = []; default = [];
@@ -61,7 +70,7 @@ in
description = "gokill daemon"; description = "gokill daemon";
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
ExecStart = "${gokill-pkg}/bin/gokill -c ${configFile}"; ExecStart = "${gokill-pkg}/bin/gokill -c ${configFile} ${testRun}";
Restart = "on-failure"; Restart = "on-failure";
}; };