summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/defaults-write.nix4
-rw-r--r--modules/system/defaults/dock.nix33
2 files changed, 20 insertions, 17 deletions
diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix
index cf0a10a..d69a2c3 100644
--- a/modules/system/defaults-write.nix
+++ b/modules/system/defaults-write.nix
@@ -6,13 +6,15 @@ let
cfg = config.system.defaults;
+ isFloat = x: isString x && builtins.match "^[+-]?([1-9]*[.])?[0-9]+$" x != null;
+
boolValue = x: if x then "YES" else "NO";
writeValue = value:
if isBool value then "-bool ${boolValue value}" else
if isInt value then "-int ${toString value}" else
+ if isFloat value then "-float ${toString value}" else
if isString value then "-string '${value}'" else
- if isAttrs value then "-${value.type} '${value.value}'" else
throw "invalid value type";
writeDefault = domain: key: value:
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.
'';