forked from mirrors/nixpkgs
nixos: Move build-vm into virtualisation.vmVariant
... which is like a specialisation, but for nixos-rebuild build-vm
This commit is contained in:
parent
8fd49c116b
commit
f72432aeb2
|
@ -9,24 +9,6 @@ let
|
|||
modules = [ configuration ];
|
||||
};
|
||||
|
||||
# This is for `nixos-rebuild build-vm'.
|
||||
vm = eval.extendModules {
|
||||
modules = [ ./modules/virtualisation/qemu-vm.nix ];
|
||||
};
|
||||
|
||||
# This is for `nixos-rebuild build-vm-with-bootloader'.
|
||||
vmWithBootLoader = vm.extendModules {
|
||||
modules = [
|
||||
({ config, ... }: {
|
||||
_file = "nixos/default.nix##vmWithBootLoader";
|
||||
virtualisation.useBootLoader = true;
|
||||
virtualisation.useEFIBoot =
|
||||
config.boot.loader.systemd-boot.enable ||
|
||||
config.boot.loader.efi.canTouchEfiVariables;
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -34,7 +16,7 @@ in
|
|||
|
||||
system = eval.config.system.build.toplevel;
|
||||
|
||||
vm = vm.config.system.build.vm;
|
||||
vm = eval.config.virtualisation.vmVariant.system.build.vm;
|
||||
|
||||
vmWithBootLoader = vmWithBootLoader.config.system.build.vm;
|
||||
vmWithBootLoader = eval.config.virtualisation.vmVariantWithBootLoader.system.build.vm;
|
||||
}
|
||||
|
|
|
@ -1179,6 +1179,7 @@
|
|||
./tasks/powertop.nix
|
||||
./testing/service-runner.nix
|
||||
./virtualisation/anbox.nix
|
||||
./virtualisation/build-vm.nix
|
||||
./virtualisation/container-config.nix
|
||||
./virtualisation/containerd.nix
|
||||
./virtualisation/containers.nix
|
||||
|
|
46
nixos/modules/virtualisation/build-vm.nix
Normal file
46
nixos/modules/virtualisation/build-vm.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{ extendModules, lib, ... }:
|
||||
let
|
||||
|
||||
inherit (lib)
|
||||
mkOption
|
||||
;
|
||||
|
||||
vmVariant = extendModules {
|
||||
modules = [ ./qemu-vm.nix ];
|
||||
};
|
||||
|
||||
vmVariantWithBootLoader = vmVariant.extendModules {
|
||||
modules = [
|
||||
({ config, ... }: {
|
||||
_file = "nixos/default.nix##vmWithBootLoader";
|
||||
virtualisation.useBootLoader = true;
|
||||
virtualisation.useEFIBoot =
|
||||
config.boot.loader.systemd-boot.enable ||
|
||||
config.boot.loader.efi.canTouchEfiVariables;
|
||||
})
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
||||
virtualisation.vmVariant = mkOption {
|
||||
description = ''
|
||||
Machine configuration to be added for the vm script produced by <literal>nixos-rebuild build-vm</literal>.
|
||||
'';
|
||||
inherit (vmVariant) type;
|
||||
default = {};
|
||||
visible = "shallow";
|
||||
};
|
||||
|
||||
virtualisation.vmVariantWithBootLoader = mkOption {
|
||||
description = ''
|
||||
Machine configuration to be added for the vm script produced by <literal>nixos-rebuild build-vm-with-bootloader</literal>.
|
||||
'';
|
||||
inherit (vmVariantWithBootLoader) type;
|
||||
default = {};
|
||||
visible = "shallow";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue