about summary refs log tree commit diff
path: root/nixos/modules/services/misc/snapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/misc/snapper.nix')
-rw-r--r--nixos/modules/services/misc/snapper.nix20
1 files changed, 14 insertions, 6 deletions
diff --git a/nixos/modules/services/misc/snapper.nix b/nixos/modules/services/misc/snapper.nix
index 8cff517c56d9c..42f782bcd6e18 100644
--- a/nixos/modules/services/misc/snapper.nix
+++ b/nixos/modules/services/misc/snapper.nix
@@ -35,6 +35,14 @@ let
     descriptionClass = "conjunction";
   };
 
+  intOrNumberOrRange = lib.types.either lib.types.ints.unsigned (
+    lib.types.strMatching "[[:digit:]]+(\-[[:digit:]]+)?"
+    // {
+      description = "string containing either a number or a range";
+      descriptionClass = "conjunction";
+    }
+  );
+
   configOptions = {
     SUBVOLUME = lib.mkOption {
       type = lib.types.path;
@@ -93,7 +101,7 @@ let
     };
 
     TIMELINE_LIMIT_HOURLY = lib.mkOption {
-      type = lib.types.int;
+      type = intOrNumberOrRange;
       default = 10;
       description = ''
         Limits for timeline cleanup.
@@ -101,7 +109,7 @@ let
     };
 
     TIMELINE_LIMIT_DAILY = lib.mkOption {
-      type = lib.types.int;
+      type = intOrNumberOrRange;
       default = 10;
       description = ''
         Limits for timeline cleanup.
@@ -109,7 +117,7 @@ let
     };
 
     TIMELINE_LIMIT_WEEKLY = lib.mkOption {
-      type = lib.types.int;
+      type = intOrNumberOrRange;
       default = 0;
       description = ''
         Limits for timeline cleanup.
@@ -117,7 +125,7 @@ let
     };
 
     TIMELINE_LIMIT_MONTHLY = lib.mkOption {
-      type = lib.types.int;
+      type = intOrNumberOrRange;
       default = 10;
       description = ''
         Limits for timeline cleanup.
@@ -125,7 +133,7 @@ let
     };
 
     TIMELINE_LIMIT_QUARTERLY = lib.mkOption {
-      type = lib.types.int;
+      type = intOrNumberOrRange;
       default = 0;
       description = ''
         Limits for timeline cleanup.
@@ -133,7 +141,7 @@ let
     };
 
     TIMELINE_LIMIT_YEARLY = lib.mkOption {
-      type = lib.types.int;
+      type = intOrNumberOrRange;
       default = 10;
       description = ''
         Limits for timeline cleanup.