forked from mirrors/nixpkgs
nixos-rebuild: Prefer the module lib when available
pkgs.lib and lib need not match, so prefer the one that the modules get. For example: ```nix nix-repl> :lf nixpkgs nix-repl> (lib.nixosSystem { modules = [ ({ lib, ... }: assert lib?nixosSystem; { nixpkgs.hostPlatform = "x86_64-linux"; }) ]; }).pkgs.lib?nixosSystem false ``` The code is backwards compatible, for the case where you evaluate a config whose nixpkgs doesn't have the preceding commit yet.
This commit is contained in:
parent
8e934650ce
commit
8be52599b7
|
@ -567,7 +567,7 @@ if [ "$action" = repl ]; then
|
|||
configuration._module.specialArgs //
|
||||
{
|
||||
inherit (configuration) config options;
|
||||
inherit (configuration.pkgs) lib;
|
||||
lib = configuration.lib or configuration.pkgs.lib;
|
||||
inherit flake;
|
||||
};
|
||||
in builtins.seq scope builtins.trace motd scope
|
||||
|
|
Loading…
Reference in a new issue