virtualisation/proxmox-image: use system.build.image

This commit is contained in:
phaer 2024-11-15 00:18:54 +01:00
parent 342a5021df
commit a0ce661c99

View File

@ -9,6 +9,7 @@ with lib;
{
imports = [
./disk-size-option.nix
../image/file-options.nix
(lib.mkRenamedOptionModuleWith {
sinceRelease = 2411;
from = [
@ -250,8 +251,12 @@ with lib;
message = "'legacy+gpt' disk partitioning requires 'seabios' bios";
}
];
image.baseName = lib.mkDefault "vzdump-qemu-${cfg.filenameSuffix}";
image.extension = "vma.zst";
system.build.image = config.system.build.VMA;
system.build.VMA = import ../../lib/make-disk-image.nix {
name = "proxmox-${cfg.filenameSuffix}";
baseName = config.image.baseName;
inherit (cfg) partitionTableType;
postVM =
let
@ -299,16 +304,16 @@ with lib;
});
in
''
${vma}/bin/vma create "vzdump-qemu-${cfg.filenameSuffix}.vma" \
${vma}/bin/vma create "${config.image.baseName}.vma" \
-c ${
cfgFile "qemu-server.conf" (cfg.qemuConf // cfg.qemuExtraConf)
}/qemu-server.conf drive-virtio0=$diskImage
rm $diskImage
${pkgs.zstd}/bin/zstd "vzdump-qemu-${cfg.filenameSuffix}.vma"
mv "vzdump-qemu-${cfg.filenameSuffix}.vma.zst" $out/
${pkgs.zstd}/bin/zstd "${config.image.baseName}.vma"
mv "${config.image.fileName}" $out/
mkdir -p $out/nix-support
echo "file vma $out/vzdump-qemu-${cfg.filenameSuffix}.vma.zst" > $out/nix-support/hydra-build-products
echo "file vma $out/${config.image.fileName}" > $out/nix-support/hydra-build-products
'';
inherit (cfg.qemuConf) additionalSpace bootSize;
inherit (config.virtualisation) diskSize;