2012-03-02 13:38:22 +01:00
|
|
|
{ configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config>
|
2009-11-06 02:00:44 +01:00
|
|
|
, system ? builtins.currentSystem
|
2015-11-18 01:26:00 +01:00
|
|
|
, extraModules ? []
|
|
|
|
# This attribute is used to specify a different nixos version, a different
|
|
|
|
# system or additional modules which might be set conditionally.
|
|
|
|
, reEnter ? false
|
2009-06-05 15:19:39 +02:00
|
|
|
}:
|
2007-09-18 17:06:24 +02:00
|
|
|
|
2009-06-05 15:19:39 +02:00
|
|
|
let
|
2015-11-18 01:26:00 +01:00
|
|
|
reEnterModule = {
|
|
|
|
config.nixos.path = with (import ../lib); mkIf reEnter (mkForce null);
|
|
|
|
config.nixos.configuration = configuration;
|
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-11-06 02:00:44 +01:00
|
|
|
eval = import ./lib/eval-config.nix {
|
2013-10-01 15:48:39 +02:00
|
|
|
inherit system;
|
2015-11-18 01:26:00 +01:00
|
|
|
modules = [ configuration reEnterModule ] ++ extraModules;
|
2009-11-06 02:00:44 +01:00
|
|
|
};
|
2009-08-19 17:04:11 +02:00
|
|
|
|
2013-10-28 22:43:29 +01:00
|
|
|
inherit (eval) pkgs;
|
2009-05-27 11:16:56 +02:00
|
|
|
|
2010-09-13 14:34:58 +02:00
|
|
|
# This is for `nixos-rebuild build-vm'.
|
2009-08-11 03:35:56 +02:00
|
|
|
vmConfig = (import ./lib/eval-config.nix {
|
2013-10-01 15:48:39 +02:00
|
|
|
inherit system;
|
2015-11-18 01:26:00 +01:00
|
|
|
modules = [ configuration reEnterModule ./modules/virtualisation/qemu-vm.nix ] ++ extraModules;
|
2009-08-11 03:35:56 +02:00
|
|
|
}).config;
|
2010-09-13 14:34:58 +02:00
|
|
|
|
|
|
|
# This is for `nixos-rebuild build-vm-with-bootloader'.
|
|
|
|
vmWithBootLoaderConfig = (import ./lib/eval-config.nix {
|
2013-10-01 15:48:39 +02:00
|
|
|
inherit system;
|
2010-09-13 14:34:58 +02:00
|
|
|
modules =
|
2015-11-18 01:26:00 +01:00
|
|
|
[ configuration reEnterModule
|
2010-09-13 14:34:58 +02:00
|
|
|
./modules/virtualisation/qemu-vm.nix
|
|
|
|
{ virtualisation.useBootLoader = true; }
|
2012-07-21 18:30:58 +02:00
|
|
|
];
|
2010-09-13 14:34:58 +02:00
|
|
|
}).config;
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2007-09-18 17:06:24 +02:00
|
|
|
in
|
|
|
|
|
2009-05-27 11:00:45 +02:00
|
|
|
{
|
2015-11-18 01:26:00 +01:00
|
|
|
inherit (eval.config.nixos.reflect) config options;
|
2009-06-15 17:50:36 +02:00
|
|
|
|
2013-10-28 22:43:29 +01:00
|
|
|
system = eval.config.system.build.toplevel;
|
2009-05-27 11:00:45 +02:00
|
|
|
|
2009-08-11 03:35:56 +02:00
|
|
|
vm = vmConfig.system.build.vm;
|
|
|
|
|
2010-09-13 14:34:58 +02:00
|
|
|
vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;
|
|
|
|
|
2009-05-28 01:14:38 +02:00
|
|
|
# The following are used by nixos-rebuild.
|
2009-05-27 11:00:45 +02:00
|
|
|
nixFallback = pkgs.nixUnstable;
|
2007-09-18 17:06:24 +02:00
|
|
|
}
|