Merge pull request #130265 from liclac/gce-image-compression-level
google-compute-image: Add a setting for GZIP compression level
This commit is contained in:
@@ -36,6 +36,14 @@ in
|
||||
`<nixpkgs/nixos/modules/virtualisation/google-compute-image.nix>`.
|
||||
'';
|
||||
};
|
||||
|
||||
virtualisation.googleComputeImage.compressionLevel = mkOption {
|
||||
type = types.int;
|
||||
default = 6;
|
||||
description = ''
|
||||
GZIP compression level of the resulting disk image (1-9).
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
#### implementation
|
||||
@@ -47,7 +55,8 @@ in
|
||||
PATH=$PATH:${with pkgs; lib.makeBinPath [ gnutar gzip ]}
|
||||
pushd $out
|
||||
mv $diskImage disk.raw
|
||||
tar -Szcf nixos-image-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.raw.tar.gz 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
|
||||
popd
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user