diff --git a/configuration/rescue-cd.nix b/configuration/rescue-cd.nix index 05420975d5f..a429304071d 100644 --- a/configuration/rescue-cd.nix +++ b/configuration/rescue-cd.nix @@ -3,6 +3,7 @@ if builtins.pathExists ../relname then builtins.readFile ../relname else "nixos-${builtins.readFile ../VERSION}" +, compressImage ? false }: rec { @@ -304,6 +305,8 @@ rec { bootable = true; bootImage = "boot/grub/stage2_eltorito"; + + inherit compressImage; }; diff --git a/helpers/make-iso9660-image.nix b/helpers/make-iso9660-image.nix index 5e0bca4c630..076820bb5c2 100644 --- a/helpers/make-iso9660-image.nix +++ b/helpers/make-iso9660-image.nix @@ -25,6 +25,9 @@ # The path (in the ISO file system) of the boot image. , bootImage ? "" +, # Whether to compress the resulting ISO image with bzip2. + compressImage ? false + }: assert bootable -> bootImage != ""; @@ -33,7 +36,7 @@ stdenv.mkDerivation { name = "iso9660-image"; builder = ./make-iso9660-image.sh; buildInputs = [perl cdrkit]; - inherit isoName bootable bootImage; + inherit isoName bootable bootImage compressImage; # !!! should use XML. sources = map (x: x.source) contents; diff --git a/helpers/make-iso9660-image.sh b/helpers/make-iso9660-image.sh index 5ad8cb475de..9330002f0b4 100644 --- a/helpers/make-iso9660-image.sh +++ b/helpers/make-iso9660-image.sh @@ -59,10 +59,15 @@ done cat pathlist | sed -e 's/=\(.*\)=\(.*\)=/\\=\1=\2\\=/' | tee pathlist.safer -# !!! -f is a quick hack. + ensureDir $out/iso -genisoimage -r -J -o $out/iso/$isoName $bootFlags \ - -hide-rr-moved -graft-points -path-list pathlist.safer +genCommand="genisoimage -r -J $bootFlags -hide-rr-moved -graft-points -path-list pathlist.safer" +if test -z "$compressImage"; then + $genCommand -o $out/iso/$isoName +else + $genCommand | bzip2 > $out/iso/$isoName.bz2 +fi + ensureDir $out/nix-support echo $system > $out/nix-support/system