diff options
Diffstat (limited to 'nixos/modules/misc/nixpkgs.nix')
-rw-r--r-- | nixos/modules/misc/nixpkgs.nix | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 5eb38c510b4..511831ae5cd 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -3,32 +3,35 @@ with lib; let - isConfig = x: - builtins.isAttrs x || builtins.isFunction x; + nixpkgsConfig = pkgs: + let + isConfig = x: + builtins.isAttrs x || builtins.isFunction x; - optCall = f: x: - if builtins.isFunction f - then f x - else f; + optCall = f: x: + if builtins.isFunction f + then f x + else f; - mergeConfig = lhs_: rhs_: - let - lhs = optCall lhs_ { inherit pkgs; }; - rhs = optCall rhs_ { inherit pkgs; }; + mergeConfig = lhs_: rhs_: + let + lhs = optCall lhs_ { inherit pkgs; }; + rhs = optCall rhs_ { inherit pkgs; }; + in + lhs // rhs // + optionalAttrs (lhs ? packageOverrides) { + packageOverrides = pkgs: + optCall lhs.packageOverrides pkgs // + optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; + }; in - lhs // rhs // - optionalAttrs (lhs ? packageOverrides) { - packageOverrides = pkgs: - optCall lhs.packageOverrides pkgs // - optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; + mkOptionType { + name = "nixpkgs config"; + typerep = "(nixpkgsConfig)"; + check = lib.traceValIfNot isConfig; + merge = config: args: fold (def: mergeConfig def.value) {}; + defaultValues = [{}]; }; - - configType = mkOptionType { - name = "nixpkgs config"; - check = traceValIfNot isConfig; - merge = args: fold (def: mergeConfig def.value) {}; - }; - in { @@ -46,7 +49,7 @@ in }; } ''; - type = configType; + type = nixpkgsConfig pkgs; description = '' The configuration of the Nix Packages collection. (For details, see the Nixpkgs documentation.) It allows you to set |