at 18.09-beta 1.7 kB view raw
1{ stdenv, perl, pixz, pathsFromGraph 2 3, # The file name of the resulting tarball 4 fileName ? "nixos-system-${stdenv.hostPlatform.system}" 5 6, # The files and directories to be placed in the tarball. 7 # This is a list of attribute sets {source, target} where `source' 8 # is the file system object (regular file or directory) to be 9 # grafted in the file system at path `target'. 10 contents 11 12, # In addition to `contents', the closure of the store paths listed 13 # in `packages' are also placed in the Nix store of the tarball. This is 14 # a list of attribute sets {object, symlink} where `object' if a 15 # store path whose closure will be copied, and `symlink' is a 16 # symlink to `object' that will be added to the tarball. 17 storeContents ? [] 18 19 # Extra commands to be executed before archiving files 20, extraCommands ? "" 21 22 # Extra tar arguments 23, extraArgs ? "" 24 # Command used for compression 25, compressCommand ? "pixz" 26 # Extension for the compressed tarball 27, compressionExtension ? ".xz" 28 # extra inputs, like the compressor to use 29, extraInputs ? [ pixz ] 30}: 31 32stdenv.mkDerivation { 33 name = "tarball"; 34 builder = ./make-system-tarball.sh; 35 buildInputs = [ perl ] ++ extraInputs; 36 37 inherit fileName pathsFromGraph extraArgs extraCommands compressCommand; 38 39 # !!! should use XML. 40 sources = map (x: x.source) contents; 41 targets = map (x: x.target) contents; 42 43 # !!! should use XML. 44 objects = map (x: x.object) storeContents; 45 symlinks = map (x: x.symlink) storeContents; 46 47 # For obtaining the closure of `storeContents'. 48 exportReferencesGraph = 49 map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents; 50 51 extension = compressionExtension; 52}