From d8b21c22245af2d6a6582df3290921ac5ca26235 Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Tue, 15 Apr 2014 21:13:34 +0200 Subject: 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. --- nixos/modules/config/sysctl.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index b4cd22caa79d..7f6c965b67cb 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 -- cgit 1.4.1