1source $stdenv/setup
2set -x
3
4sources_=($sources)
5targets_=($targets)
6
7echo $objects
8objects=($objects)
9symlinks=($symlinks)
10
11
12# Remove the initial slash from a path, since genisofs likes it that way.
13stripSlash() {
14 res="$1"
15 if test "${res:0:1}" = /; then res=${res:1}; fi
16}
17
18touch pathlist
19
20# Add the individual files.
21for ((i = 0; i < ${#targets_[@]}; i++)); do
22 stripSlash "${targets_[$i]}"
23 mkdir -p "$(dirname "$res")"
24 cp -a "${sources_[$i]}" "$res"
25done
26
27
28# Add the closures of the top-level store objects.
29mkdir -p nix/store
30storePaths=$(perl $pathsFromGraph closure-*)
31for i in $storePaths; do
32 cp -a "$i" "${i:1}"
33done
34
35
36# TODO tar ruxo
37# Also include a manifest of the closures in a format suitable for
38# nix-store --load-db.
39printRegistration=1 perl $pathsFromGraph closure-* > nix-path-registration
40
41# Add symlinks to the top-level store objects.
42for ((n = 0; n < ${#objects[*]}; n++)); do
43 object=${objects[$n]}
44 symlink=${symlinks[$n]}
45 if test "$symlink" != "none"; then
46 mkdir -p $(dirname ./$symlink)
47 ln -s $object ./$symlink
48 fi
49done
50
51$extraCommands
52
53mkdir -p $out/tarball
54
55rm env-vars
56
57tar --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner -cvJf $out/tarball/$fileName.tar.xz * $extraArgs
58
59mkdir -p $out/nix-support
60echo $system > $out/nix-support/system
61echo "file system-tarball $out/tarball/$fileName.tar.xz" > $out/nix-support/hydra-build-products