Compare commits

..

2 Commits

Author SHA1 Message Date
5818349d91 [nix] nixosModule: add testRun option 2023-11-01 11:04:16 +01:00
b0723ae708 [actions/shutdown] fix missing default value 2023-10-31 21:01:54 +01:00
2 changed files with 14 additions and 2 deletions

View File

@@ -30,7 +30,10 @@ func (s Shutdown) Execute() {
} }
func (s Shutdown) Create(config internal.ActionConfig, c ActionResultChan) (Action, error) { func (s Shutdown) Create(config internal.ActionConfig, c ActionResultChan) (Action, error) {
var result Shutdown result := Shutdown{
Timeout: "now",
}
err := json.Unmarshal(config.Options, &result) err := json.Unmarshal(config.Options, &result)
if err != nil { if err != nil {

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";
}; };