From 94edfe8c7b2f83650c0f6262e50063ebcdedf29d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 18 Apr 2018 15:18:05 +0200 Subject: minSleep --- nix/module.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'nix/module.nix') diff --git a/nix/module.nix b/nix/module.nix index 10c68ff..3263401 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -14,9 +14,14 @@ let type = with types; either ints.positive str; }; + minSleep = mkOption { + type = with types; nullOr ints.positive; + default = 3600; + }; + monitorTimeout = mkOption { type = with types; nullOr ints.positive; - default = 3600; + default = 3600 * 24; }; }; }; @@ -25,8 +30,11 @@ let wantedBy = [ "multi-user.target" ]; serviceConfig = { - ExecStart = '' - ${pkgs.rolling-directory}/bin/rolling-directory %I ${toString dCfg.maxSize} monitor ${optionalString (dCfg.monitorTimeout != null) (toString dCfg.monitorTimeout)} + ExecStart = let + extraArgs = optionals (dCfg.monitorTimeout != null) ["-t" (toString dCfg.monitorTimeout)] + + optionals (dCfg.minSleep != null) ["-s" (toString dCfg.minSleep)]; + in '' + ${pkgs.rolling-directory}/bin/rolling-directory %I ${toString dCfg.maxSize} monitor ${escapeShellArgs extraArgs} ''; }; }; -- cgit v1.2.3