1 { config, pkgs, lib, ... }:
11 baseImageSize = mkOption {
12 type = with types; either (enum [ "auto" ]) int;
16 The size of the hyper-v base image in MiB.
19 vmDerivationName = mkOption {
21 default = "nixos-hyperv-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}";
23 The name of the derivation for the hyper-v appliance.
26 vmFileName = mkOption {
28 default = "nixos-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.vhdx";
30 The file name of the hyper-v appliance.
37 system.build.hypervImage = import ../../lib/make-disk-image.nix {
38 name = cfg.vmDerivationName;
40 ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=dynamic -O vhdx $diskImage $out/${cfg.vmFileName}
44 diskSize = cfg.baseImageSize;
45 partitionTableType = "efi";
46 inherit config lib pkgs;
50 device = "/dev/disk/by-label/nixos";
55 fileSystems."/boot" = {
56 device = "/dev/disk/by-label/ESP";
60 boot.growPartition = true;
65 efiInstallAsRemovable = true;
68 virtualisation.hypervGuest.enable = true;