24 lines
594 B
Nix
24 lines
594 B
Nix
{
|
|
squashfsTools,
|
|
|
|
closureInfo,
|
|
runCommand
|
|
}:
|
|
{
|
|
filename ? "image",
|
|
storeContents ? [],
|
|
comp ? "xz -Xdict-size 100%"
|
|
}:
|
|
let
|
|
compFlag = if comp == null then "-no-compression" else "-comp ${comp}";
|
|
in runCommand "${filename}.squashfs" {
|
|
nativeBuildInputs = [ squashfsTools ];
|
|
} ''
|
|
closureInfo=${closureInfo { rootPaths = storeContents; }}
|
|
cp $closureInfo/registration nix-path-registration
|
|
|
|
mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $out \
|
|
-no-hardlinks -keep-as-directory -all-root -b 1048576 ${compFlag} \
|
|
-processors $NIX_BUILD_CORES
|
|
''
|