about summary refs log tree commit diff
path: root/nixos/modules/services/x11
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2022-09-09 19:59:29 +0200
committerGitHub <noreply@github.com>2022-09-09 19:59:29 +0200
commit6389a26e5f9c90ca1fd70a8e9f778b0f58d19378 (patch)
tree6b43df340849dea2cb7d13358aef49bacc453bfb /nixos/modules/services/x11
parent8f29134fcf6bcf3fae20c1d132a9e8c36eeeb7e9 (diff)
parent52bbbaeb09859b02561a1895f0516e094b2f9d67 (diff)
Merge pull request #181834 from ncfavier/numbers
lib/types: add `number`
Diffstat (limited to 'nixos/modules/services/x11')
-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 99bde5e1f0ce7..d42cf1d7412fe 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 = lib.mdDoc ''
@@ -133,7 +124,7 @@ in {
     };
 
     shadowOpacity = mkOption {
-      type = floatBetween 0 1;
+      type = types.numbers.between 0 1;
       default = 0.75;
       example = 0.8;
       description = lib.mdDoc ''
@@ -156,7 +147,7 @@ in {
     };
 
     activeOpacity = mkOption {
-      type = floatBetween 0 1;
+      type = types.numbers.between 0 1;
       default = 1.0;
       example = 0.8;
       description = lib.mdDoc ''
@@ -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 = lib.mdDoc ''
@@ -174,7 +165,7 @@ in {
     };
 
     menuOpacity = mkOption {
-      type = floatBetween 0 1;
+      type = types.numbers.between 0 1;
       default = 1.0;
       example = 0.8;
       description = lib.mdDoc ''