virtualisation/google-compute: use system.build.image

This commit is contained in:
phaer 2024-11-15 00:30:30 +01:00
parent a230d5228d
commit 41db5209c7

View File

@ -22,6 +22,7 @@ in
imports = [
./google-compute-config.nix
./disk-size-option.nix
../image/file-options.nix
(lib.mkRenamedOptionModuleWith {
sinceRelease = 2411;
from = [
@ -72,8 +73,12 @@ in
fsType = "vfat";
};
system.nixos.tags = [ "google-compute" ];
image.extension = "raw.tar.gz";
system.build.image = config.system.build.googleComputeImage;
system.build.googleComputeImage = import ../../lib/make-disk-image.nix {
name = "google-compute-image";
inherit (config.image) baseName;
postVM = ''
PATH=$PATH:${
with pkgs;
@ -83,10 +88,9 @@ in
]
}
pushd $out
mv $diskImage disk.raw
tar -Sc disk.raw | gzip -${toString cfg.compressionLevel} > \
nixos-image-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.raw.tar.gz
rm $out/disk.raw
tar -Sc $diskImage | gzip -${toString cfg.compressionLevel} > \
${config.image.fileName}
rm $diskImage
popd
'';
format = "raw";