summaryrefslogtreecommitdiff
path: root/nix/module.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/module.nix')
-rw-r--r--nix/module.nix14
1 files changed, 11 insertions, 3 deletions
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
14 type = with types; either ints.positive str; 14 type = with types; either ints.positive str;
15 }; 15 };
16 16
17 minSleep = mkOption {
18 type = with types; nullOr ints.positive;
19 default = 3600;
20 };
21
17 monitorTimeout = mkOption { 22 monitorTimeout = mkOption {
18 type = with types; nullOr ints.positive; 23 type = with types; nullOr ints.positive;
19 default = 3600; 24 default = 3600 * 24;
20 }; 25 };
21 }; 26 };
22 }; 27 };
@@ -25,8 +30,11 @@ let
25 wantedBy = [ "multi-user.target" ]; 30 wantedBy = [ "multi-user.target" ];
26 31
27 serviceConfig = { 32 serviceConfig = {
28 ExecStart = '' 33 ExecStart = let
29 ${pkgs.rolling-directory}/bin/rolling-directory %I ${toString dCfg.maxSize} monitor ${optionalString (dCfg.monitorTimeout != null) (toString dCfg.monitorTimeout)} 34 extraArgs = optionals (dCfg.monitorTimeout != null) ["-t" (toString dCfg.monitorTimeout)]
35 + optionals (dCfg.minSleep != null) ["-s" (toString dCfg.minSleep)];
36 in ''
37 ${pkgs.rolling-directory}/bin/rolling-directory %I ${toString dCfg.maxSize} monitor ${escapeShellArgs extraArgs}
30 ''; 38 '';
31 }; 39 };
32 }; 40 };