1 { stdenv, squashfsTools, closureInfo
3 , # The root directory of the squashfs filesystem is filled with the
4 # closures of the Nix store paths listed here.
6 , # Compression parameters.
7 # For zstd compression you can use "zstd -Xcompression-level 6".
8 comp ? "xz -Xdict-size 100%"
12 name = "squashfs.img";
14 nativeBuildInputs = [ squashfsTools ];
18 closureInfo=${closureInfo { rootPaths = storeContents; }}
20 # Also include a manifest of the closures in a format suitable
21 # for nix-store --load-db.
22 cp $closureInfo/registration nix-path-registration
24 # 64 cores on i686 does not work
25 # fails with FATAL ERROR: mangle2:: xz compress failed with error code 5
26 if ((NIX_BUILD_CORES > 48)); then
30 # Generate the squashfs image.
31 mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $out \
32 -no-hardlinks -keep-as-directory -all-root -b 1048576 -comp ${comp} \
33 -processors $NIX_BUILD_CORES