summary refs log tree commit diff
path: root/nixos/modules/virtualisation
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2021-08-13 14:31:08 +0000
committerGitHub <noreply@github.com>2021-08-13 14:31:08 +0000
commit9451a23e9f07278a1abdb03f6eb20ff85570e8b9 (patch)
tree6088e4aaecdeb9d3be7a8faf39c00c28848ab671 /nixos/modules/virtualisation
parent134801ac987501f248d2856515bb5dd157ec7434 (diff)
parent91646d62b9cd513820a4b82371da341fa9ec1218 (diff)
downloadnixpkgs-9451a23e9f07278a1abdb03f6eb20ff85570e8b9.tar
nixpkgs-9451a23e9f07278a1abdb03f6eb20ff85570e8b9.tar.gz
nixpkgs-9451a23e9f07278a1abdb03f6eb20ff85570e8b9.tar.bz2
nixpkgs-9451a23e9f07278a1abdb03f6eb20ff85570e8b9.tar.lz
nixpkgs-9451a23e9f07278a1abdb03f6eb20ff85570e8b9.tar.xz
nixpkgs-9451a23e9f07278a1abdb03f6eb20ff85570e8b9.tar.zst
nixpkgs-9451a23e9f07278a1abdb03f6eb20ff85570e8b9.zip
Merge pull request #130265 from liclac/gce-image-compression-level
google-compute-image: Add a setting for GZIP compression level
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r--nixos/modules/virtualisation/google-compute-image.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/google-compute-image.nix b/nixos/modules/virtualisation/google-compute-image.nix
index 79c3921669e..0c72696f802 100644
--- a/nixos/modules/virtualisation/google-compute-image.nix
+++ b/nixos/modules/virtualisation/google-compute-image.nix
@@ -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
       '';