3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #85947 from prusnak/images-zstd

Use zstd for ISO and SD images
This commit is contained in:
Marek Mahut 2020-06-07 19:09:43 +02:00 committed by GitHub
commit 7b9d7cc05d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 10 deletions

View file

@ -466,6 +466,9 @@ systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www" ];
<title>Other Notable Changes</title> <title>Other Notable Changes</title>
<itemizedlist> <itemizedlist>
<listitem>
<para>SD and ISO images are now compressed by default using <literal>zstd</literal>.</para>
</listitem>
<listitem> <listitem>
<para> <para>
<option>services.journald.rateLimitBurst</option> was updated from <option>services.journald.rateLimitBurst</option> was updated from

View file

@ -34,7 +34,7 @@
, # The path (outside the ISO file system) of the isohybrid-mbr image. , # The path (outside the ISO file system) of the isohybrid-mbr image.
isohybridMbrImage ? "" isohybridMbrImage ? ""
, # Whether to compress the resulting ISO image with bzip2. , # Whether to compress the resulting ISO image with zstd.
compressImage ? false compressImage ? false
, # The volume ID. , # The volume ID.
@ -48,7 +48,7 @@ assert usbBootable -> isohybridMbrImage != "";
stdenv.mkDerivation { stdenv.mkDerivation {
name = isoName; name = isoName;
builder = ./make-iso9660-image.sh; builder = ./make-iso9660-image.sh;
buildInputs = [ xorriso syslinux ]; buildInputs = [ xorriso syslinux zstd ];
inherit isoName bootable bootImage compressImage volumeID efiBootImage efiBootable isohybridMbrImage usbBootable; inherit isoName bootable bootImage compressImage volumeID efiBootImage efiBootable isohybridMbrImage usbBootable;

View file

@ -129,9 +129,14 @@ fi
if test -n "$compressImage"; then if test -n "$compressImage"; then
echo "Compressing image..." echo "Compressing image..."
bzip2 $out/iso/$isoName zstd -T$NIX_BUILD_CORES $out/iso/$isoName
fi fi
mkdir -p $out/nix-support mkdir -p $out/nix-support
echo $system > $out/nix-support/system 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

View file

@ -41,6 +41,7 @@ let
pkgs.time pkgs.time
pkgs.utillinux pkgs.utillinux
pkgs.which # 88K size pkgs.which # 88K size
pkgs.zstd
]; ];
in in

View file

@ -413,7 +413,7 @@ in
default = false; default = false;
description = '' description = ''
Whether the ISO image should be compressed using Whether the ISO image should be compressed using
<command>bzip2</command>. <command>zstd</command>.
''; '';
}; };

View file

@ -105,7 +105,7 @@ in
default = true; default = true;
description = '' description = ''
Whether the SD image should be compressed using Whether the SD image should be compressed using
<command>bzip2</command>. <command>zstd</command>.
''; '';
}; };
@ -130,10 +130,10 @@ in
sdImage.storePaths = [ config.system.build.toplevel ]; sdImage.storePaths = [ config.system.build.toplevel ];
system.build.sdImage = pkgs.callPackage ({ stdenv, dosfstools, e2fsprogs, 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; name = config.sdImage.imageName;
nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux bzip2 zstd ]; nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux zstd ];
inherit (config.sdImage) compressImage; inherit (config.sdImage) compressImage;
@ -143,7 +143,7 @@ in
echo "${pkgs.stdenv.buildPlatform.system}" > $out/nix-support/system echo "${pkgs.stdenv.buildPlatform.system}" > $out/nix-support/system
if test -n "$compressImage"; then 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 else
echo "file sd-image $img" >> $out/nix-support/hydra-build-products echo "file sd-image $img" >> $out/nix-support/hydra-build-products
fi fi
@ -190,7 +190,7 @@ in
fsck.vfat -vn firmware_part.img fsck.vfat -vn firmware_part.img
dd conv=notrunc if=firmware_part.img of=$img seek=$START count=$SECTORS dd conv=notrunc if=firmware_part.img of=$img seek=$START count=$SECTORS
if test -n "$compressImage"; then if test -n "$compressImage"; then
bzip2 $img zstd -T$NIX_BUILD_CORES $img
fi fi
''; '';
}) {}; }) {};