mirror of
https://github.com/nix-community/raspberry-pi-nix.git
synced 2025-11-09 03:56: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
|
let
|
||||||
rootfsImage = pkgs.callPackage "${modulesPath}/../lib/make-ext4-fs.nix" ({
|
rootfsImage = pkgs.callPackage "${modulesPath}/../lib/make-ext4-fs.nix" ({
|
||||||
inherit (config.sdImage) storePaths;
|
inherit (config.sdImage) storePaths;
|
||||||
compressImage = true;
|
compressImage = config.sdImage.compressDuringBuild;
|
||||||
populateImageCommands = config.sdImage.populateRootCommands;
|
populateImageCommands = config.sdImage.populateRootCommands;
|
||||||
volumeLabel = "NIXOS_SD";
|
volumeLabel = "NIXOS_SD";
|
||||||
} // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
|
} // 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 {
|
expandOnBoot = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
|
@ -172,7 +180,7 @@ in
|
||||||
nativeBuildInputs =
|
nativeBuildInputs =
|
||||||
[ dosfstools e2fsprogs mtools libfaketime util-linux zstd ];
|
[ dosfstools e2fsprogs mtools libfaketime util-linux zstd ];
|
||||||
|
|
||||||
inherit (config.sdImage) compressImage;
|
inherit (config.sdImage) compressImage compressDuringBuild;
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out/nix-support $out/sd-image
|
mkdir -p $out/nix-support $out/sd-image
|
||||||
|
|
@ -185,8 +193,12 @@ in
|
||||||
echo "file sd-image $img" >> $out/nix-support/hydra-build-products
|
echo "file sd-image $img" >> $out/nix-support/hydra-build-products
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Decompressing rootfs image"
|
if test -n "$compressDuringBuild"; then
|
||||||
zstd -d --no-progress "${rootfsImage}" -o ./root-fs.img
|
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 in front of the first partition, in MiB
|
||||||
gap=${toString config.sdImage.firmwarePartitionOffset}
|
gap=${toString config.sdImage.firmwarePartitionOffset}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue