virtualisation/vmware-image: vmware.vmFileName -> image.fileName

This commit is contained in:
phaer 2024-11-15 00:05:20 +01:00
parent 47c83cb438
commit b0b3a75676

View File

@ -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";