From d7e67ce030e6b7ec41f5f3beb011992c698984e2 Mon Sep 17 00:00:00 2001 From: pjan vandaele Date: Sun, 31 Dec 2017 11:44:02 +0900 Subject: float type --- modules/system/defaults/dock.nix | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'modules/system/defaults') diff --git a/modules/system/defaults/dock.nix b/modules/system/defaults/dock.nix index 1fd97c3..378d703 100644 --- a/modules/system/defaults/dock.nix +++ b/modules/system/defaults/dock.nix @@ -2,7 +2,17 @@ with lib; -{ +let + isFloat = x: isString x && builtins.match "^[+-]?([0-9]*[.])?[0-9]+$" x != null; + + float = mkOptionType { + name = "float"; + description = "float"; + check = isFloat; + merge = options.mergeOneOption; + }; + +in { options = { system.defaults.dock.autohide = mkOption { @@ -14,24 +24,18 @@ with lib; }; system.defaults.dock.autohide-delay = mkOption { - type = types.nullOr types.attrs; + type = types.nullOr float; default = null; - example = { - type = "float"; - value = "0.24"; - }; + example = "0.24"; description = '' Sets the speed of the autohide delay. The default is given in the example. ''; }; system.defaults.dock.autohide-time-modifier = mkOption { - type = types.nullOr types.attrs; + type = types.nullOr float; default = null; - example = { - type = "float"; - value = "1.0"; - }; + example = "1.0"; description = '' Sets the speed of the animation when hiding/showing the Dock. The default is given in the example. ''; @@ -54,12 +58,9 @@ with lib; }; system.defaults.dock.expose-animation-duration = mkOption { - type = types.nullOr types.attrs; + type = types.nullOr float; default = null; - example = { - type = "float"; - value = "1.0"; - }; + example = "1.0"; description = '' Sets the speed of the Mission Control animations. The default is given in the example. ''; -- cgit v1.2.3