mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-09-19 07:47:20 +03:00
rootfs: Compress rootfs image when asked to
This commit is contained in:
parent
f7506b5ec8
commit
08101434f7
@ -4,6 +4,8 @@
|
||||
let
|
||||
inherit (config.boot) growPartition;
|
||||
inherit (lib) optionalString;
|
||||
inherit (config.mobile._internal) compressLargeArtifacts;
|
||||
inherit (pkgs) buildPackages;
|
||||
in
|
||||
{
|
||||
boot.loader.grub.enable = false;
|
||||
@ -32,6 +34,21 @@ in
|
||||
|
||||
# Give some headroom for initial mounting.
|
||||
extraPadding = pkgs.imageBuilder.size.MiB 20;
|
||||
|
||||
# FIXME: See #117, move compression into the image builder.
|
||||
# Zstd can take a long time to complete successfully at high compression
|
||||
# levels. Increasing the compression level could lead to timeouts.
|
||||
postProcess = optionalString compressLargeArtifacts ''
|
||||
(PS4=" $ "; set -x
|
||||
PATH="$PATH:${buildPackages.zstd}/bin"
|
||||
cd $out
|
||||
ls -lh
|
||||
time zstd -10 --rm "$filename"
|
||||
ls -lh
|
||||
)
|
||||
'';
|
||||
|
||||
zstd = compressLargeArtifacts;
|
||||
}
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user