10 cfg = config.virtualisation.azureImage;
15 ./disk-size-option.nix
16 ../image/file-options.nix
17 (lib.mkRenamedOptionModuleWith {
31 options.virtualisation.azureImage = {
36 ESP partition size. Unit is MB.
37 Only effective when vmGeneration is `v2`.
42 type = with types; listOf attrs;
45 Extra contents to add to the image.
49 vmGeneration = mkOption {
59 For v2, secure boot needs to be turned off during creation.
65 image.extension = "vhd";
66 system.nixos.tags = [ "azure" ];
67 system.build.image = config.system.build.azureImage;
68 system.build.azureImage = import ../../lib/make-disk-image.nix {
70 inherit (config.image) baseName;
72 ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=fixed,force_size -O vpc $diskImage $out/${config.image.fileName}
75 configFile = ./azure-config-user.nix;
78 bootSize = "${toString cfg.bootSize}M";
79 partitionTableType = if cfg.vmGeneration == "v2" then "efi" else "legacy";
81 inherit (cfg) contents;
82 inherit (config.virtualisation) diskSize;
83 inherit config lib pkgs;