diff options
| author | Michael Hoang <Enzime@users.noreply.github.com> | 2024-03-04 16:16:05 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-04 16:16:05 +1100 |
| commit | 530f265072c35731e100a863efbf916ea902408f (patch) | |
| tree | dcd144f9978843de2e5811b18269df2f37bad16f /modules | |
| parent | 17c2ca3c7537a2512224242b84e1ea3c08e79b92 (diff) | |
| parent | b620e32a761ef6376c1097e73b3f8283604e4982 (diff) | |
Merge pull request #897 from dfrankland/fix-writing-values-with-containers
fix writing values with containers
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/system/defaults-write.nix | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix index 2e56d74..7e1fc44 100644 --- a/modules/system/defaults-write.nix +++ b/modules/system/defaults-write.nix @@ -5,18 +5,8 @@ with lib; let cfg = config.system.defaults; - 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 ${strings.floatToString value}" else - if isString value then "-string '${value}'" else - if isList value then "-array ${concatStringsSep " " (map (v: writeValue v)value)}" else - throw "invalid value type"; - writeDefault = domain: key: value: - "defaults write ${domain} '${key}' ${writeValue value}"; + "defaults write ${domain} '${key}' $'${strings.escape [ "'" ] (generators.toPlist { } value)}'"; defaultsToList = domain: attrs: mapAttrsToList (writeDefault domain) (filterAttrs (n: v: v != null) attrs); |
