12 ./disk-size-option.nix
13 ../image/file-options.nix
17 format = lib.mkOption {
18 description = "Format of the disk image to generate: raw or qcow2";
19 type = lib.types.enum [
25 efiSupport = lib.mkOption {
26 description = "Whether the disk image should support EFI boot or legacy boot";
27 type = lib.types.bool;
33 boot.loader.grub = lib.mkIf (!cfg.efiSupport) {
34 enable = lib.mkOptionDefault true;
35 devices = lib.mkDefault [ "/dev/vda" ];
37 boot.loader.systemd-boot.enable = lib.mkDefault cfg.efiSupport;
38 boot.growPartition = lib.mkDefault true;
42 device = "/dev/disk/by-label/nixos";
46 "/boot" = lib.mkIf (cfg.efiSupport) {
47 device = "/dev/disk/by-label/ESP";
52 system.nixos.tags = [ cfg.format ] ++ lib.optionals cfg.efiSupport [ "efi" ];
53 image.extension = cfg.format;
54 system.build.image = import ../../lib/make-disk-image.nix {
55 inherit lib config pkgs;
56 inherit (config.virtualisation) diskSize;
57 inherit (cfg) baseName format;
58 partitionTableType = if cfg.efiSupport then "efi" else "legacy";