16 ./disk-size-option.nix
17 ../image/file-options.nix
18 (lib.mkRenamedOptionModuleWith {
29 (lib.mkRenamedOptionModuleWith {
45 vmDerivationName = mkOption {
47 default = "nixos-hyperv-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}";
49 The name of the derivation for the hyper-v appliance.
56 # Use a priority just below mkOptionDefault (1500) instead of lib.mkDefault
57 # to avoid breaking existing configs using that.
58 virtualisation.diskSize = lib.mkOverride 1490 (4 * 1024);
60 system.nixos.tags = [ "hyperv" ];
61 image.extension = "vhdx";
62 system.build.image = config.system.build.hypervImage;
63 system.build.hypervImage = import ../../lib/make-disk-image.nix {
64 name = cfg.vmDerivationName;
65 baseName = config.image.baseName;
67 ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=dynamic -O vhdx $diskImage $out/${config.image.fileName}
71 inherit (config.virtualisation) diskSize;
72 partitionTableType = "efi";
73 inherit config lib pkgs;
77 device = "/dev/disk/by-label/nixos";
82 fileSystems."/boot" = {
83 device = "/dev/disk/by-label/ESP";
87 boot.growPartition = true;
92 efiInstallAsRemovable = true;
95 virtualisation.hypervGuest.enable = true;