2
0
Files
liminix/pkgs/liminix-tools/builders/squashfs.nix
Peter Collingbourne 17d8576cc4 Make Liminix usable as an input to a flake
This change allows Liminix to be used as a non-flake input to a flake
by making <nixpkgs> into a default argument.

An example flake that makes use of this is here:
https://github.com/pcc/liminix-flake-demo
2026-05-03 04:02:31 -07:00

35 lines
971 B
Nix

{
buildPackages,
callPackage,
nixpkgs,
pseudofile,
runCommand,
writeText,
}:
filesystem:
let
pseudofiles = pseudofile.write "files.pf" filesystem;
storefs = callPackage "${nixpkgs}/nixos/lib/make-squashfs.nix" {
# 1) Every required package is referenced from somewhere
# outside /nix/store. 2) Every file outside the store is
# specified by config.filesystem. 3) Therefore, closing over
# the pseudofile will give us all the needed packages
storeContents = [ pseudofiles ];
};
in
runCommand "frob-squashfs"
{
nativeBuildInputs = with buildPackages; [
squashfsTools
qprint
];
}
''
cp ${storefs} ./store.img
chmod +w store.img
mksquashfs - store.img -exit-on-error -no-recovery -quiet -no-progress -root-becomes store -p "/ d 0755 0 0"
mksquashfs - store.img -exit-on-error -no-recovery -quiet -no-progress -root-becomes nix -p "/ d 0755 0 0" -pf ${pseudofiles}
cp store.img $out
''