Skip to content

Commit

Permalink
virtualisation/google-compute: use system.build.image
Browse files Browse the repository at this point in the history
  • Loading branch information
phaer committed Nov 29, 2024
1 parent a230d52 commit 41db520
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions nixos/modules/virtualisation/google-compute-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ in
imports = [
./google-compute-config.nix
./disk-size-option.nix
../image/file-options.nix
(lib.mkRenamedOptionModuleWith {
sinceRelease = 2411;
from = [
Expand Down Expand Up @@ -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;
Expand All @@ -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";
Expand Down

0 comments on commit 41db520

Please sign in to comment.