1 { config, pkgs, lib, ... }:
3 boolToStr = value: if value then "on" else "off";
17 baseImageSize = lib.mkOption {
18 type = with lib.types; either (enum [ "auto" ]) int;
22 The size of the VMWare base image in MiB.
25 vmDerivationName = lib.mkOption {
27 default = "nixos-vmware-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}";
29 The name of the derivation for the VMWare appliance.
32 vmFileName = lib.mkOption {
34 default = "nixos-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.vmdk";
36 The file name of the VMWare appliance.
39 vmSubformat = lib.mkOption {
40 type = lib.types.enum subformats;
41 default = "monolithicSparse";
42 description = "Specifies which VMDK subformat to use.";
44 vmCompat6 = lib.mkOption {
45 type = lib.types.bool;
48 description = "Create a VMDK version 6 image (instead of version 4).";
54 system.build.vmwareImage = import ../../lib/make-disk-image.nix {
55 name = cfg.vmDerivationName;
57 ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o compat6=${boolToStr cfg.vmCompat6},subformat=${cfg.vmSubformat} -O vmdk $diskImage $out/${cfg.vmFileName}
61 diskSize = cfg.baseImageSize;
62 partitionTableType = "efi";
63 inherit config lib pkgs;
67 device = "/dev/disk/by-label/nixos";
72 fileSystems."/boot" = {
73 device = "/dev/disk/by-label/ESP";
77 boot.growPartition = true;
82 efiInstallAsRemovable = true;
85 virtualisation.vmware.guest.enable = true;