From b0b3a756769aad26f25dee8d5f984c5d0c94559a Mon Sep 17 00:00:00 2001 From: phaer Date: Fri, 15 Nov 2024 00:05:20 +0100 Subject: [PATCH] virtualisation/vmware-image: vmware.vmFileName -> image.fileName --- nixos/modules/virtualisation/vmware-image.nix | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/nixos/modules/virtualisation/vmware-image.nix b/nixos/modules/virtualisation/vmware-image.nix index 21aee5f4ed8b..162d3dc0a0cc 100644 --- a/nixos/modules/virtualisation/vmware-image.nix +++ b/nixos/modules/virtualisation/vmware-image.nix @@ -17,6 +17,23 @@ let ]; in { + imports = [ + ../image/file-options.nix + (lib.mkRenamedOptionModuleWith { + sinceRelease = 2505; + from = [ + "virtualisation" + "vmware" + "vmFileName" + ]; + to = [ + "image" + "fileName" + ]; + }) + + ]; + options = { vmware = { baseImageSize = lib.mkOption { @@ -34,13 +51,6 @@ in { The name of the derivation for the VMWare appliance. ''; }; - vmFileName = lib.mkOption { - type = lib.types.str; - default = "nixos-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.vmdk"; - description = '' - The file name of the VMWare appliance. - ''; - }; vmSubformat = lib.mkOption { type = lib.types.enum subformats; default = "monolithicSparse"; @@ -56,10 +66,14 @@ in { }; config = { + system.nixos.tags = [ "vmware" ]; + image.extension = "vmdk"; + system.build.image = config.system.build.vmwareImage; system.build.vmwareImage = import ../../lib/make-disk-image.nix { name = cfg.vmDerivationName; + baseName = config.image.baseName; postVM = '' - ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o compat6=${boolToStr cfg.vmCompat6},subformat=${cfg.vmSubformat} -O vmdk $diskImage $out/${cfg.vmFileName} + ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o compat6=${boolToStr cfg.vmCompat6},subformat=${cfg.vmSubformat} -O vmdk $diskImage $out/${config.image.fileName} rm $diskImage ''; format = "raw";