at 15.09-beta 877 B view raw
1{ stdenv, squashfsTools, perl, pathsFromGraph 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 buildInputs = [perl squashfsTools]; 12 13 # For obtaining the closure of `storeContents'. 14 exportReferencesGraph = 15 map (x: [("closure-" + baseNameOf x) x]) storeContents; 16 17 buildCommand = 18 '' 19 # Add the closures of the top-level store objects. 20 storePaths=$(perl ${pathsFromGraph} closure-*) 21 22 # Also include a manifest of the closures in a format suitable 23 # for nix-store --load-db. 24 printRegistration=1 perl ${pathsFromGraph} closure-* > nix-path-registration 25 26 # Generate the squashfs image. 27 mksquashfs nix-path-registration $storePaths $out \ 28 -keep-as-directory -all-root 29 ''; 30}