2018-10-30 10:44:00 +03:00
|
|
|
{ stdenv, closureInfo, pixz
|
2010-02-16 02:27:51 +03:00
|
|
|
|
|
|
|
, # The file name of the resulting tarball
|
2018-08-20 22:11:29 +03:00
|
|
|
fileName ? "nixos-system-${stdenv.hostPlatform.system}"
|
2010-02-16 02:27:51 +03: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 04:45:33 +04:00
|
|
|
|
2014-12-12 00:54:46 +03:00
|
|
|
# Extra commands to be executed before archiving files
|
|
|
|
, extraCommands ? ""
|
|
|
|
|
2014-08-25 04:45:33 +04:00
|
|
|
# Extra tar arguments
|
|
|
|
, extraArgs ? ""
|
2018-03-18 03:26:42 +03: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 02:27:51 +03:00
|
|
|
}:
|
|
|
|
|
2018-10-30 10:44:00 +03:00
|
|
|
let
|
|
|
|
symlinks = map (x: x.symlink) storeContents;
|
|
|
|
objects = map (x: x.object) storeContents;
|
|
|
|
in
|
|
|
|
|
2010-02-16 02:27:51 +03:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "tarball";
|
|
|
|
builder = ./make-system-tarball.sh;
|
2020-11-18 15:58:24 +03:00
|
|
|
nativeBuildInputs = extraInputs;
|
2011-09-14 22:20:50 +04:00
|
|
|
|
2018-10-30 10:44:00 +03:00
|
|
|
inherit fileName extraArgs extraCommands compressCommand;
|
2010-02-16 02:27:51 +03:00
|
|
|
|
|
|
|
# !!! should use XML.
|
|
|
|
sources = map (x: x.source) contents;
|
|
|
|
targets = map (x: x.target) contents;
|
|
|
|
|
|
|
|
# !!! should use XML.
|
2018-10-30 10:44:00 +03:00
|
|
|
inherit symlinks objects;
|
2011-09-14 22:20:50 +04:00
|
|
|
|
2018-10-30 10:44:00 +03:00
|
|
|
closureInfo = closureInfo {
|
|
|
|
rootPaths = objects;
|
|
|
|
};
|
2018-03-18 03:26:42 +03:00
|
|
|
|
|
|
|
extension = compressionExtension;
|
2010-02-16 02:27:51 +03:00
|
|
|
}
|