diff options
author | Maciej Krüger <mkg20001@gmail.com> | 2023-10-24 02:06:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-24 02:06:36 +0200 |
commit | 1ecbbb6e3f22427f61a28d6e2d758966fb5f0287 (patch) | |
tree | 5da56cdab0eacac8bc83bdf0b67a068f3c8d05d6 /nixos/lib | |
parent | 5fb487096d9357584365216e0485c421f50dcba0 (diff) | |
parent | c2ff509e66a2e4b3e2f1a24a20fa4340f34aba49 (diff) |
Merge pull request #260595 from adamcstephens/lxc/squashfs
lxc-container: add squashfs image support and release output
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/make-squashfs.nix | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/nixos/lib/make-squashfs.nix b/nixos/lib/make-squashfs.nix index b7c7078b73b1b..4b6b567399484 100644 --- a/nixos/lib/make-squashfs.nix +++ b/nixos/lib/make-squashfs.nix @@ -1,15 +1,22 @@ { lib, stdenv, squashfsTools, closureInfo +, fileName ? "squashfs" , # The root directory of the squashfs filesystem is filled with the # closures of the Nix store paths listed here. storeContents ? [] + # Pseudo files to be added to squashfs image +, pseudoFiles ? [] +, noStrip ? false , # Compression parameters. # For zstd compression you can use "zstd -Xcompression-level 6". comp ? "xz -Xdict-size 100%" }: +let + pseudoFilesArgs = lib.concatMapStrings (f: ''-p "${f}" '') pseudoFiles; +in stdenv.mkDerivation { - name = "squashfs.img"; + name = "${fileName}.img"; __structuredAttrs = true; nativeBuildInputs = [ squashfsTools ]; @@ -31,8 +38,8 @@ stdenv.mkDerivation { '' + '' # Generate the squashfs image. - mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $out \ - -no-hardlinks -keep-as-directory -all-root -b 1048576 -comp ${comp} \ + mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $out ${pseudoFilesArgs} \ + -no-hardlinks ${lib.optionalString noStrip "-no-strip"} -keep-as-directory -all-root -b 1048576 -comp ${comp} \ -processors $NIX_BUILD_CORES ''; } |