lol

make-squashfs: add support for pseudoFiles, custom name, and disabling strip

+10 -3
+10 -3
nixos/lib/make-squashfs.nix
··· 1 1 { lib, stdenv, squashfsTools, closureInfo 2 2 3 + , fileName ? "squashfs" 3 4 , # The root directory of the squashfs filesystem is filled with the 4 5 # closures of the Nix store paths listed here. 5 6 storeContents ? [] 7 + # Pseudo files to be added to squashfs image 8 + , pseudoFiles ? [] 9 + , noStrip ? false 6 10 , # Compression parameters. 7 11 # For zstd compression you can use "zstd -Xcompression-level 6". 8 12 comp ? "xz -Xdict-size 100%" 9 13 }: 10 14 15 + let 16 + pseudoFilesArgs = lib.concatMapStrings (f: ''-p "${f}" '') pseudoFiles; 17 + in 11 18 stdenv.mkDerivation { 12 - name = "squashfs.img"; 19 + name = "${fileName}.img"; 13 20 __structuredAttrs = true; 14 21 15 22 nativeBuildInputs = [ squashfsTools ]; ··· 31 38 '' + '' 32 39 33 40 # Generate the squashfs image. 34 - mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $out \ 35 - -no-hardlinks -keep-as-directory -all-root -b 1048576 -comp ${comp} \ 41 + mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $out ${pseudoFilesArgs} \ 42 + -no-hardlinks ${lib.optionalString noStrip "-no-strip"} -keep-as-directory -all-root -b 1048576 -comp ${comp} \ 36 43 -processors $NIX_BUILD_CORES 37 44 ''; 38 45 }