8 boolToStr = value: if value then "on" else "off";
14 "twoGbMaxExtentSparse"
22 ../image/file-options.nix
23 (lib.mkRenamedOptionModuleWith {
40 baseImageSize = lib.mkOption {
41 type = with lib.types; either (enum [ "auto" ]) int;
45 The size of the VMWare base image in MiB.
48 vmDerivationName = lib.mkOption {
50 default = "nixos-vmware-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}";
52 The name of the derivation for the VMWare appliance.
55 vmSubformat = lib.mkOption {
56 type = lib.types.enum subformats;
57 default = "monolithicSparse";
58 description = "Specifies which VMDK subformat to use.";
60 vmCompat6 = lib.mkOption {
61 type = lib.types.bool;
64 description = "Create a VMDK version 6 image (instead of version 4).";
70 system.nixos.tags = [ "vmware" ];
71 image.extension = "vmdk";
72 system.build.image = config.system.build.vmwareImage;
73 system.build.vmwareImage = import ../../lib/make-disk-image.nix {
74 name = cfg.vmDerivationName;
75 baseName = config.image.baseName;
77 ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o compat6=${boolToStr cfg.vmCompat6},subformat=${cfg.vmSubformat} -O vmdk $diskImage $out/${config.image.fileName}
81 diskSize = cfg.baseImageSize;
82 partitionTableType = "efi";
83 inherit config lib pkgs;
87 device = "/dev/disk/by-label/nixos";
92 fileSystems."/boot" = {
93 device = "/dev/disk/by-label/ESP";
97 boot.growPartition = true;
102 efiInstallAsRemovable = true;
105 virtualisation.vmware.guest.enable = true;