mirror of
https://github.com/nix-community/raspberry-pi-nix.git
synced 2025-11-08 19:46:03 +01:00
add option to skip compression during build
I found this decreased the image-generating part from 5m46s to 3m30s Trying to find out a cache size difference, I did not see a change in size of: `nix-tree --derivation ./result` (probably because I don't know how to properly check that)
This commit is contained in:
parent
628e512d60
commit
f75552ebcc
1 changed files with 16 additions and 4 deletions
|
|
@ -24,7 +24,7 @@ with lib;
|
|||
let
|
||||
rootfsImage = pkgs.callPackage "${modulesPath}/../lib/make-ext4-fs.nix" ({
|
||||
inherit (config.sdImage) storePaths;
|
||||
compressImage = true;
|
||||
compressImage = config.sdImage.compressDuringBuild;
|
||||
populateImageCommands = config.sdImage.populateRootCommands;
|
||||
volumeLabel = "NIXOS_SD";
|
||||
} // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
|
||||
|
|
@ -141,6 +141,14 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
compressDuringBuild = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether the SD image should be compressed during intermediate build steps (saving cache space, but takes longer)
|
||||
'';
|
||||
};
|
||||
|
||||
expandOnBoot = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
|
|
@ -172,7 +180,7 @@ in
|
|||
nativeBuildInputs =
|
||||
[ dosfstools e2fsprogs mtools libfaketime util-linux zstd ];
|
||||
|
||||
inherit (config.sdImage) compressImage;
|
||||
inherit (config.sdImage) compressImage compressDuringBuild;
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/nix-support $out/sd-image
|
||||
|
|
@ -185,8 +193,12 @@ in
|
|||
echo "file sd-image $img" >> $out/nix-support/hydra-build-products
|
||||
fi
|
||||
|
||||
echo "Decompressing rootfs image"
|
||||
zstd -d --no-progress "${rootfsImage}" -o ./root-fs.img
|
||||
if test -n "$compressDuringBuild"; then
|
||||
echo "Decompressing rootfs image"
|
||||
zstd -d --no-progress "${rootfsImage}" -o ./root-fs.img
|
||||
else
|
||||
ln -s "${rootfsImage}" ./root-fs.img
|
||||
fi
|
||||
|
||||
# Gap in front of the first partition, in MiB
|
||||
gap=${toString config.sdImage.firmwarePartitionOffset}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue