at 23.11-pre 1.4 kB view raw
1{ config, extendModules, lib, ... }: 2let 3 4 inherit (lib) 5 mkOption 6 ; 7 8 vmVariant = extendModules { 9 modules = [ ./qemu-vm.nix ]; 10 }; 11 12 vmVariantWithBootLoader = vmVariant.extendModules { 13 modules = [ 14 ({ config, ... }: { 15 _file = "nixos/default.nix##vmWithBootLoader"; 16 virtualisation.useBootLoader = true; 17 virtualisation.useEFIBoot = 18 config.boot.loader.systemd-boot.enable || 19 config.boot.loader.efi.canTouchEfiVariables; 20 }) 21 ]; 22 }; 23in 24{ 25 options = { 26 27 virtualisation.vmVariant = mkOption { 28 description = lib.mdDoc '' 29 Machine configuration to be added for the vm script produced by `nixos-rebuild build-vm`. 30 ''; 31 inherit (vmVariant) type; 32 default = {}; 33 visible = "shallow"; 34 }; 35 36 virtualisation.vmVariantWithBootLoader = mkOption { 37 description = lib.mdDoc '' 38 Machine configuration to be added for the vm script produced by `nixos-rebuild build-vm-with-bootloader`. 39 ''; 40 inherit (vmVariantWithBootLoader) type; 41 default = {}; 42 visible = "shallow"; 43 }; 44 45 }; 46 47 config = { 48 49 system.build = { 50 vm = lib.mkDefault config.virtualisation.vmVariant.system.build.vm; 51 vmWithBootLoader = lib.mkDefault config.virtualisation.vmVariantWithBootLoader.system.build.vm; 52 }; 53 54 }; 55 56 # uses extendModules 57 meta.buildDocsInSandbox = false; 58}