From 28334988dbd613012b1b085c37d144889f8e2abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Thu, 29 Sep 2022 11:34:00 +0200 Subject: [PATCH] picom: use `types.numbers.between` Mirrors https://github.com/NixOS/nixpkgs/commit/77307fcff86d3e56285b006b3e9204c6b45d90f0 --- modules/services/picom.nix | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/modules/services/picom.nix b/modules/services/picom.nix index a279c155b..75ed6a72a 100644 --- a/modules/services/picom.nix +++ b/modules/services/picom.nix @@ -16,16 +16,6 @@ let description = "pair of ${x.description}"; }; - floatBetween = a: b: - with types; - let - # toString prints floats with hardcoded high precision - floatToString = f: 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 @@ -96,7 +86,7 @@ in { }; fadeSteps = mkOption { - type = pairOf (floatBetween 1.0e-2 1); + type = pairOf (types.numbers.between 1.0e-2 1); default = [ 2.8e-2 3.0e-2 ]; example = [ 4.0e-2 4.0e-2 ]; description = '' @@ -132,7 +122,7 @@ in { }; shadowOpacity = mkOption { - type = floatBetween 0 1; + type = types.numbers.between 0 1; default = 0.75; example = 0.8; description = '' @@ -151,7 +141,7 @@ in { }; activeOpacity = mkOption { - type = floatBetween 0 1; + type = types.numbers.between 0 1; default = 1.0; example = 0.8; description = '' @@ -160,7 +150,7 @@ in { }; inactiveOpacity = mkOption { - type = floatBetween 0.1 1; + type = types.numbers.between 0.1 1; default = 1.0; example = 0.8; description = '' @@ -169,7 +159,7 @@ in { }; menuOpacity = mkOption { - type = floatBetween 0 1; + type = types.numbers.between 0 1; default = 1.0; example = 0.8; description = ''