about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2022-07-17 12:56:40 +0200
committerNaïm Favier <n@monade.li>2022-07-24 18:03:28 +0200
commit77307fcff86d3e56285b006b3e9204c6b45d90f0 (patch)
tree0de73c0ea07b1bd8d0de8dc8b29dc4a3b0e60ab5 /nixos
parenteb72be85415765d1538bdf6e3b06090614f7a6f7 (diff)
downloadnixlib-77307fcff86d3e56285b006b3e9204c6b45d90f0.tar
nixlib-77307fcff86d3e56285b006b3e9204c6b45d90f0.tar.gz
nixlib-77307fcff86d3e56285b006b3e9204c6b45d90f0.tar.bz2
nixlib-77307fcff86d3e56285b006b3e9204c6b45d90f0.tar.lz
nixlib-77307fcff86d3e56285b006b3e9204c6b45d90f0.tar.xz
nixlib-77307fcff86d3e56285b006b3e9204c6b45d90f0.tar.zst
nixlib-77307fcff86d3e56285b006b3e9204c6b45d90f0.zip
nixos/picom: use `types.numbers.between`
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/x11/picom.nix19
1 files changed, 5 insertions, 14 deletions
diff --git a/nixos/modules/services/x11/picom.nix b/nixos/modules/services/x11/picom.nix
index 2eef71f71fcb..85aa11f147b4 100644
--- a/nixos/modules/services/x11/picom.nix
+++ b/nixos/modules/services/x11/picom.nix
@@ -11,15 +11,6 @@ let
     addCheck (listOf x) (y: length y == 2)
     // { description = "pair of ${x.description}"; };
 
-  floatBetween = a: b: with types;
-    let
-      # toString prints floats with hardcoded high precision
-      floatToString = f: builtins.toJSON f;
-    in
-      addCheck float (x: x <= b && x >= a)
-      // { description = "a floating point number in " +
-                         "range [${floatToString a}, ${floatToString b}]"; };
-
   mkDefaultAttrs = mapAttrs (n: v: mkDefault v);
 
   # Basically a tinkered lib.generators.mkKeyValueDefault
@@ -93,7 +84,7 @@ in {
     };
 
     fadeSteps = mkOption {
-      type = pairOf (floatBetween 0.01 1);
+      type = pairOf (types.numbers.between 0.01 1);
       default = [ 0.028 0.03 ];
       example = [ 0.04 0.04 ];
       description = ''
@@ -133,7 +124,7 @@ in {
     };
 
     shadowOpacity = mkOption {
-      type = floatBetween 0 1;
+      type = types.numbers.between 0 1;
       default = 0.75;
       example = 0.8;
       description = ''
@@ -156,7 +147,7 @@ in {
     };
 
     activeOpacity = mkOption {
-      type = floatBetween 0 1;
+      type = types.numbers.between 0 1;
       default = 1.0;
       example = 0.8;
       description = ''
@@ -165,7 +156,7 @@ in {
     };
 
     inactiveOpacity = mkOption {
-      type = floatBetween 0.1 1;
+      type = types.numbers.between 0.1 1;
       default = 1.0;
       example = 0.8;
       description = ''
@@ -174,7 +165,7 @@ in {
     };
 
     menuOpacity = mkOption {
-      type = floatBetween 0 1;
+      type = types.numbers.between 0 1;
       default = 1.0;
       example = 0.8;
       description = ''