at 22.05-pre 1.6 kB view raw
1{ stdenv, closureInfo, pixz 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 32let 33 symlinks = map (x: x.symlink) storeContents; 34 objects = map (x: x.object) storeContents; 35in 36 37stdenv.mkDerivation { 38 name = "tarball"; 39 builder = ./make-system-tarball.sh; 40 nativeBuildInputs = extraInputs; 41 42 inherit fileName extraArgs extraCommands compressCommand; 43 44 # !!! should use XML. 45 sources = map (x: x.source) contents; 46 targets = map (x: x.target) contents; 47 48 # !!! should use XML. 49 inherit symlinks objects; 50 51 closureInfo = closureInfo { 52 rootPaths = objects; 53 }; 54 55 extension = compressionExtension; 56}