mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-14 15:36:47 +03:00
make-squashfs: add support for pseudoFiles, custom name, and disabling strip
This commit is contained in:
parent
d4e6bfe297
commit
a91bd0b468
@ -1,15 +1,22 @@
|
|||||||
{ lib, stdenv, squashfsTools, closureInfo
|
{ lib, stdenv, squashfsTools, closureInfo
|
||||||
|
|
||||||
|
, fileName ? "squashfs"
|
||||||
, # The root directory of the squashfs filesystem is filled with the
|
, # The root directory of the squashfs filesystem is filled with the
|
||||||
# closures of the Nix store paths listed here.
|
# closures of the Nix store paths listed here.
|
||||||
storeContents ? []
|
storeContents ? []
|
||||||
|
# Pseudo files to be added to squashfs image
|
||||||
|
, pseudoFiles ? []
|
||||||
|
, noStrip ? false
|
||||||
, # Compression parameters.
|
, # Compression parameters.
|
||||||
# For zstd compression you can use "zstd -Xcompression-level 6".
|
# For zstd compression you can use "zstd -Xcompression-level 6".
|
||||||
comp ? "xz -Xdict-size 100%"
|
comp ? "xz -Xdict-size 100%"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
pseudoFilesArgs = lib.concatMapStrings (f: ''-p "${f}" '') pseudoFiles;
|
||||||
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "squashfs.img";
|
name = "${fileName}.img";
|
||||||
__structuredAttrs = true;
|
__structuredAttrs = true;
|
||||||
|
|
||||||
nativeBuildInputs = [ squashfsTools ];
|
nativeBuildInputs = [ squashfsTools ];
|
||||||
@ -31,8 +38,8 @@ stdenv.mkDerivation {
|
|||||||
'' + ''
|
'' + ''
|
||||||
|
|
||||||
# Generate the squashfs image.
|
# Generate the squashfs image.
|
||||||
mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $out \
|
mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $out ${pseudoFilesArgs} \
|
||||||
-no-hardlinks -keep-as-directory -all-root -b 1048576 -comp ${comp} \
|
-no-hardlinks ${lib.optionalString noStrip "-no-strip"} -keep-as-directory -all-root -b 1048576 -comp ${comp} \
|
||||||
-processors $NIX_BUILD_CORES
|
-processors $NIX_BUILD_CORES
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user