diff options
author | Ricardo M. Correia <rcorreia@wizy.org> | 2014-04-15 21:13:34 +0200 |
---|---|---|
committer | Ricardo M. Correia <rcorreia@wizy.org> | 2014-04-15 21:52:04 +0200 |
commit | d8b21c22245af2d6a6582df3290921ac5ca26235 (patch) | |
tree | 40bfe4918d39a1c076509d20a3592d4ae72e1ec1 /nixos/modules/config/sysctl.nix | |
parent | e572b5c10444b7bb5339260359349e1069df486d (diff) |
nixos: Fix sysctl option merging
Using pkgs.lib.mkOverride in a sysctl option would throw a bogus error. Also, if you defined a sysctl multiple times in the same configuration, only one of the values would be picked up, while the others were silently discarded. This patch should fix both issues. If you define a sysctl multiple times at your highest defined priority level, you will get a proper error with detailed location information.
Diffstat (limited to 'nixos/modules/config/sysctl.nix')
-rw-r--r-- | nixos/modules/config/sysctl.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index b4cd22caa79d4..7f6c965b67cb3 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -6,8 +6,12 @@ let sysctlOption = mkOptionType { name = "sysctl option value"; - check = x: isBool x || isString x || isInt x || isNull x; - merge = args: defs: (last defs).value; # FIXME: hacky way to allow overriding in configuration.nix. + check = val: + let + checkType = x: isBool x || isString x || isInt x || isNull x; + in + checkType val || (val._type or "" == "override" && checkType val.content); + merge = loc: defs: mergeOneOption loc (filterOverrides defs); }; in |