1 if [ -e "$NIX_ATTRS_SH_FILE" ]; then .
"$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh
]; then . .attrs.sh
; fi
2 source "${stdenv}/setup"
3 echo "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}"
6 cat <<EOF > "${out}/compositeImage.sh"
9 # Create a tar archive of a docker image's layers, docker image config
10 # json, manifest.json, and repositories json; this streams directly to
11 # stdout and is intended to be used in concert with docker load, i.e:
13 # ${out}/compositeImage.sh | docker load
15 # The first character follow the 's' command for sed becomes the
16 # delimiter sed will use; this makes the transformation regex easy to
17 # read. We feed tar a file listing the files we want in the archive,
18 # because the paths are absolute and docker load wants them flattened in
19 # the archive, we need to transform all of the paths going in by
20 # stripping everything *including* the last solidus so that we end up
21 # with the basename of the path.
23 --transform='s=.*/==' \
24 --transform="s=.*-manifest.json=manifest.json=" \
25 --transform="s=.*-repositories=repositories=" \
26 -c "${manifest}" "${repositories}" -T "${imageFileStorePaths}"
28 chmod +x
"${out}/compositeImage.sh"