1{ stdenv, perl, xz, pathsFromGraph
2
3, # The file name of the resulting tarball
4 fileName ? "nixos-system-${stdenv.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}:
25
26stdenv.mkDerivation {
27 name = "tarball";
28 builder = ./make-system-tarball.sh;
29 buildInputs = [perl xz];
30
31 inherit fileName pathsFromGraph extraArgs extraCommands;
32
33 # !!! should use XML.
34 sources = map (x: x.source) contents;
35 targets = map (x: x.target) contents;
36
37 # !!! should use XML.
38 objects = map (x: x.object) storeContents;
39 symlinks = map (x: x.symlink) storeContents;
40
41 # For obtaining the closure of `storeContents'.
42 exportReferencesGraph =
43 map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents;
44}