mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 06:31:02 +00:00
f9b05ac1fe
This makes it possible to build several NixOS systems that use different nixpkgs in the same nix-build invocation. Today, you can't do that since the <nixpkgs> path reference is hard-coded in lib/eval-config.nix.
47 lines
1 KiB
Nix
47 lines
1 KiB
Nix
{ configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config>
|
|
, system ? builtins.currentSystem
|
|
, nixpkgs ? <nixpkgs>
|
|
}:
|
|
|
|
let
|
|
|
|
eval = import ./lib/eval-config.nix {
|
|
inherit system nixpkgs;
|
|
modules = [ configuration ];
|
|
};
|
|
|
|
inherit (eval) config pkgs;
|
|
|
|
# This is for `nixos-rebuild build-vm'.
|
|
vmConfig = (import ./lib/eval-config.nix {
|
|
inherit system nixpkgs;
|
|
modules = [ configuration ./modules/virtualisation/qemu-vm.nix ];
|
|
}).config;
|
|
|
|
# This is for `nixos-rebuild build-vm-with-bootloader'.
|
|
vmWithBootLoaderConfig = (import ./lib/eval-config.nix {
|
|
inherit system nixpkgs;
|
|
modules =
|
|
[ configuration
|
|
./modules/virtualisation/qemu-vm.nix
|
|
{ virtualisation.useBootLoader = true; }
|
|
];
|
|
}).config;
|
|
|
|
in
|
|
|
|
{
|
|
inherit eval config;
|
|
|
|
system = config.system.build.toplevel;
|
|
|
|
vm = vmConfig.system.build.vm;
|
|
|
|
vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;
|
|
|
|
# The following are used by nixos-rebuild.
|
|
nixFallback = pkgs.nixUnstable;
|
|
|
|
tests = config.tests;
|
|
}
|