diff options
author | Robert Hensing <robert@roberthensing.nl> | 2018-10-27 14:51:54 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2018-10-27 14:51:54 +0200 |
commit | a54a799d59f2a4fba2e119e0c42dbe96c2c74a68 (patch) | |
tree | fe242efaede6df22fbc233ff28a0fcb10d745961 /nixos/modules/misc/nixpkgs.nix | |
parent | 889a5c35127e4e6b2c722611dcaa9c802337446b (diff) | |
download | nixlib-a54a799d59f2a4fba2e119e0c42dbe96c2c74a68.tar nixlib-a54a799d59f2a4fba2e119e0c42dbe96c2c74a68.tar.gz nixlib-a54a799d59f2a4fba2e119e0c42dbe96c2c74a68.tar.bz2 nixlib-a54a799d59f2a4fba2e119e0c42dbe96c2c74a68.tar.lz nixlib-a54a799d59f2a4fba2e119e0c42dbe96c2c74a68.tar.xz nixlib-a54a799d59f2a4fba2e119e0c42dbe96c2c74a68.tar.zst nixlib-a54a799d59f2a4fba2e119e0c42dbe96c2c74a68.zip |
NixOS: nixpkgs.pkgs: Append overlays when specified
Diffstat (limited to 'nixos/modules/misc/nixpkgs.nix')
-rw-r--r-- | nixos/modules/misc/nixpkgs.nix | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 7f9833e184ab..3e9f93b95e64 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, options, lib, pkgs, ... }: with lib; let cfg = config.nixpkgs; + opt = options.nixpkgs; isConfig = x: builtins.isAttrs x || lib.isFunction x; @@ -54,6 +55,12 @@ let check = builtins.isAttrs; }; + defaultPkgs = import ../../.. { + inherit (cfg) config overlays localSystem crossSystem; + }; + + finalPkgs = if opt.pkgs.isDefined then cfg.pkgs.appendOverlays cfg.overlays else defaultPkgs; + in { @@ -65,9 +72,6 @@ in inherit (cfg) config overlays localSystem crossSystem; } ''; - default = import ../../.. { - inherit (cfg) config overlays localSystem crossSystem; - }; type = pkgsType; example = literalExample ''import <nixpkgs> {}''; description = '' @@ -128,12 +132,14 @@ in description = '' List of overlays to use with the Nix Packages collection. (For details, see the Nixpkgs documentation.) It allows - you to override packages globally. This is a function that + you to override packages globally. Each function in the list takes as an argument the <emphasis>original</emphasis> Nixpkgs. The first argument should be used for finding dependencies, and the second should be used for overriding recipes. - Ignored when <code>nixpkgs.pkgs</code> is set. + If <code>nixpkgs.pkgs</code> is set, overlays specified here + will be applied after the overlays that were already present + in <code>nixpkgs.pkgs</code>. ''; }; @@ -207,8 +213,8 @@ in config = { _module.args = { - pkgs = cfg.pkgs; - pkgs_i686 = cfg.pkgs.pkgsi686Linux; + pkgs = finalPkgs; + pkgs_i686 = finalPkgs.pkgsi686Linux; }; }; } |