NixOS: nixpkgs.pkgs: Append overlays when specified
This commit is contained in:
parent
889a5c3512
commit
a54a799d59
@ -1,9 +1,10 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, options, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.nixpkgs;
|
cfg = config.nixpkgs;
|
||||||
|
opt = options.nixpkgs;
|
||||||
|
|
||||||
isConfig = x:
|
isConfig = x:
|
||||||
builtins.isAttrs x || lib.isFunction x;
|
builtins.isAttrs x || lib.isFunction x;
|
||||||
@ -54,6 +55,12 @@ let
|
|||||||
check = builtins.isAttrs;
|
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
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -65,9 +72,6 @@ in
|
|||||||
inherit (cfg) config overlays localSystem crossSystem;
|
inherit (cfg) config overlays localSystem crossSystem;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
default = import ../../.. {
|
|
||||||
inherit (cfg) config overlays localSystem crossSystem;
|
|
||||||
};
|
|
||||||
type = pkgsType;
|
type = pkgsType;
|
||||||
example = literalExample ''import <nixpkgs> {}'';
|
example = literalExample ''import <nixpkgs> {}'';
|
||||||
description = ''
|
description = ''
|
||||||
@ -128,12 +132,14 @@ in
|
|||||||
description = ''
|
description = ''
|
||||||
List of overlays to use with the Nix Packages collection.
|
List of overlays to use with the Nix Packages collection.
|
||||||
(For details, see the Nixpkgs documentation.) It allows
|
(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.
|
takes as an argument the <emphasis>original</emphasis> Nixpkgs.
|
||||||
The first argument should be used for finding dependencies, and
|
The first argument should be used for finding dependencies, and
|
||||||
the second should be used for overriding recipes.
|
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 = {
|
config = {
|
||||||
_module.args = {
|
_module.args = {
|
||||||
pkgs = cfg.pkgs;
|
pkgs = finalPkgs;
|
||||||
pkgs_i686 = cfg.pkgs.pkgsi686Linux;
|
pkgs_i686 = finalPkgs.pkgsi686Linux;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -22091,7 +22091,7 @@ with pkgs;
|
|||||||
* The result can be extended in the modules by defining
|
* The result can be extended in the modules by defining
|
||||||
* extra options in system.build.
|
* extra options in system.build.
|
||||||
*
|
*
|
||||||
* Unlike in plain NixOS, the nixpkgs.config, nixpkgs.overlays and
|
* Unlike in plain NixOS, the nixpkgs.config and
|
||||||
* nixpkgs.system options will be ignored by default. Instead,
|
* nixpkgs.system options will be ignored by default. Instead,
|
||||||
* nixpkgs.pkgs will have the default value of pkgs as it was
|
* nixpkgs.pkgs will have the default value of pkgs as it was
|
||||||
* constructed right after invoking the nixpkgs function (e.g. the
|
* constructed right after invoking the nixpkgs function (e.g. the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user