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