at 18.09-beta 719 B view raw
1{ stdenv, squashfsTools, closureInfo 2 3, # The root directory of the squashfs filesystem is filled with the 4 # closures of the Nix store paths listed here. 5 storeContents ? [] 6}: 7 8stdenv.mkDerivation { 9 name = "squashfs.img"; 10 11 nativeBuildInputs = [ squashfsTools ]; 12 13 buildCommand = 14 '' 15 closureInfo=${closureInfo { rootPaths = storeContents; }} 16 17 # Also include a manifest of the closures in a format suitable 18 # for nix-store --load-db. 19 cp $closureInfo/registration nix-path-registration 20 21 # Generate the squashfs image. 22 mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $out \ 23 -keep-as-directory -all-root -b 1048576 -comp xz -Xdict-size 100% 24 ''; 25}