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