From c09ffc7a5584ac3f9fbf0cee3e0e6f6596a6ed37 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 24 Apr 2020 15:38:01 +0200 Subject: [PATCH 1/4] sd-image: use zstd for compression --- nixos/modules/installer/cd-dvd/sd-image.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nixos/modules/installer/cd-dvd/sd-image.nix b/nixos/modules/installer/cd-dvd/sd-image.nix index 901c60befb6..732319b654d 100644 --- a/nixos/modules/installer/cd-dvd/sd-image.nix +++ b/nixos/modules/installer/cd-dvd/sd-image.nix @@ -105,7 +105,7 @@ in default = true; description = '' Whether the SD image should be compressed using - bzip2. + zstd. ''; }; @@ -130,10 +130,10 @@ in sdImage.storePaths = [ config.system.build.toplevel ]; system.build.sdImage = pkgs.callPackage ({ stdenv, dosfstools, e2fsprogs, - mtools, libfaketime, utillinux, bzip2, zstd }: stdenv.mkDerivation { + mtools, libfaketime, utillinux, zstd }: stdenv.mkDerivation { name = config.sdImage.imageName; - nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux bzip2 zstd ]; + nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux zstd ]; inherit (config.sdImage) compressImage; @@ -143,7 +143,7 @@ in echo "${pkgs.stdenv.buildPlatform.system}" > $out/nix-support/system if test -n "$compressImage"; then - echo "file sd-image $img.bz2" >> $out/nix-support/hydra-build-products + echo "file sd-image $img.zst" >> $out/nix-support/hydra-build-products else echo "file sd-image $img" >> $out/nix-support/hydra-build-products fi @@ -190,7 +190,7 @@ in fsck.vfat -vn firmware_part.img dd conv=notrunc if=firmware_part.img of=$img seek=$START count=$SECTORS if test -n "$compressImage"; then - bzip2 $img + zstd -T$NIX_BUILD_CORES $img fi ''; }) {}; From f20fd89fc02454f41ec4844c3ddf03b7edbe2639 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 24 Apr 2020 18:12:42 +0200 Subject: [PATCH 2/4] iso-image: use zstd for compression --- nixos/lib/make-iso9660-image.nix | 4 ++-- nixos/lib/make-iso9660-image.sh | 9 +++++++-- nixos/modules/installer/cd-dvd/iso-image.nix | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/nixos/lib/make-iso9660-image.nix b/nixos/lib/make-iso9660-image.nix index 0f3f2b5b523..be8ad9912db 100644 --- a/nixos/lib/make-iso9660-image.nix +++ b/nixos/lib/make-iso9660-image.nix @@ -34,7 +34,7 @@ , # The path (outside the ISO file system) of the isohybrid-mbr image. isohybridMbrImage ? "" -, # Whether to compress the resulting ISO image with bzip2. +, # Whether to compress the resulting ISO image with zstd. compressImage ? false , # The volume ID. @@ -48,7 +48,7 @@ assert usbBootable -> isohybridMbrImage != ""; stdenv.mkDerivation { name = isoName; builder = ./make-iso9660-image.sh; - buildInputs = [ xorriso syslinux ]; + buildInputs = [ xorriso syslinux zstd ]; inherit isoName bootable bootImage compressImage volumeID efiBootImage efiBootable isohybridMbrImage usbBootable; diff --git a/nixos/lib/make-iso9660-image.sh b/nixos/lib/make-iso9660-image.sh index d4633d2c8d1..eb9edcd7026 100644 --- a/nixos/lib/make-iso9660-image.sh +++ b/nixos/lib/make-iso9660-image.sh @@ -129,9 +129,14 @@ fi if test -n "$compressImage"; then echo "Compressing image..." - bzip2 $out/iso/$isoName + zstd -T$NIX_BUILD_CORES $out/iso/$isoName fi mkdir -p $out/nix-support echo $system > $out/nix-support/system -echo "file iso $out/iso/$isoName" >> $out/nix-support/hydra-build-products + +if test -n "$compressImage"; then + echo "file iso $out/iso/$isoName.zst" >> $out/nix-support/hydra-build-products +else + echo "file iso $out/iso/$isoName" >> $out/nix-support/hydra-build-products +fi diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index cce7cc235ec..1cd2252ecf2 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -413,7 +413,7 @@ in default = false; description = '' Whether the ISO image should be compressed using - bzip2. + zstd. ''; }; From 8a675956362b9873d7b771e1f86848f6aff612fe Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 24 Apr 2020 18:13:37 +0200 Subject: [PATCH 3/4] nixos/system-path: add zstd --- nixos/modules/config/system-path.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 4100ec89701..b9898d8155f 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -43,6 +43,7 @@ let pkgs.time pkgs.utillinux pkgs.which # 88K size + pkgs.zstd ]; in From 99f4ca8bf89d32c27acee1e9074de11c0d065593 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 24 Apr 2020 18:45:07 +0200 Subject: [PATCH 4/4] manual/rl-2009.xml: add mention about SD/ISO images compression --- nixos/doc/manual/release-notes/rl-2009.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml index 955c19bd98e..3b73f388da2 100644 --- a/nixos/doc/manual/release-notes/rl-2009.xml +++ b/nixos/doc/manual/release-notes/rl-2009.xml @@ -277,6 +277,9 @@ environment.systemPackages = [ Other Notable Changes + + SD and ISO images are now compressed by default using zstd. + was updated from