2018-03-18 01:26:42 +01:00
|
|
|
{ stdenv, perl, pixz, pathsFromGraph
|
2010-02-16 00:27:51 +01:00
|
|
|
|
|
|
|
, # The file name of the resulting tarball
|
2010-09-08 18:53:36 +02:00
|
|
|
fileName ? "nixos-system-${stdenv.system}"
|
2010-02-16 00:27:51 +01:00
|
|
|
|
|
|
|
, # The files and directories to be placed in the tarball.
|
|
|
|
# This is a list of attribute sets {source, target} where `source'
|
|
|
|
# is the file system object (regular file or directory) to be
|
|
|
|
# grafted in the file system at path `target'.
|
|
|
|
contents
|
|
|
|
|
|
|
|
, # In addition to `contents', the closure of the store paths listed
|
|
|
|
# in `packages' are also placed in the Nix store of the tarball. This is
|
|
|
|
# a list of attribute sets {object, symlink} where `object' if a
|
|
|
|
# store path whose closure will be copied, and `symlink' is a
|
|
|
|
# symlink to `object' that will be added to the tarball.
|
|
|
|
storeContents ? []
|
2014-08-25 02:45:33 +02:00
|
|
|
|
2014-12-11 22:54:46 +01:00
|
|
|
# Extra commands to be executed before archiving files
|
|
|
|
, extraCommands ? ""
|
|
|
|
|
2014-08-25 02:45:33 +02:00
|
|
|
# Extra tar arguments
|
|
|
|
, extraArgs ? ""
|
2018-03-18 01:26:42 +01:00
|
|
|
# Command used for compression
|
|
|
|
, compressCommand ? "pixz"
|
|
|
|
# Extension for the compressed tarball
|
|
|
|
, compressionExtension ? ".xz"
|
|
|
|
# extra inputs, like the compressor to use
|
|
|
|
, extraInputs ? [ pixz ]
|
2010-02-16 00:27:51 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "tarball";
|
|
|
|
builder = ./make-system-tarball.sh;
|
2018-03-18 01:26:42 +01:00
|
|
|
buildInputs = [ perl ] ++ extraInputs;
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2018-03-18 01:26:42 +01:00
|
|
|
inherit fileName pathsFromGraph extraArgs extraCommands compressCommand;
|
2010-02-16 00:27:51 +01:00
|
|
|
|
|
|
|
# !!! should use XML.
|
|
|
|
sources = map (x: x.source) contents;
|
|
|
|
targets = map (x: x.target) contents;
|
|
|
|
|
|
|
|
# !!! should use XML.
|
|
|
|
objects = map (x: x.object) storeContents;
|
|
|
|
symlinks = map (x: x.symlink) storeContents;
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-02-16 00:27:51 +01:00
|
|
|
# For obtaining the closure of `storeContents'.
|
|
|
|
exportReferencesGraph =
|
|
|
|
map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents;
|
2018-03-18 01:26:42 +01:00
|
|
|
|
|
|
|
extension = compressionExtension;
|
2010-02-16 00:27:51 +01:00
|
|
|
}
|