1 { config, lib, pkgs, ... }:
5 cfg = config.virtualisation.azureImage;
8 imports = [ ./azure-common.nix ];
10 options.virtualisation.azureImage = {
12 type = with types; either (enum [ "auto" ]) int;
16 Size of disk image. Unit is MB.
24 ESP partition size. Unit is MB.
25 Only effective when vmGeneration is `v2`.
30 type = with types; listOf attrs;
33 Extra contents to add to the image.
37 vmGeneration = mkOption {
38 type = with types; enum [ "v1" "v2" ];
42 For v2, secure boot needs to be turned off during creation.
48 system.build.azureImage = import ../../lib/make-disk-image.nix {
51 ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=fixed,force_size -O vpc $diskImage $out/disk.vhd
54 configFile = ./azure-config-user.nix;
57 bootSize = "${toString cfg.bootSize}M";
58 partitionTableType = if cfg.vmGeneration == "v2" then "efi" else "legacy";
60 inherit (cfg) diskSize contents;
61 inherit config lib pkgs;