-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ryan Trinkle
committed
Mar 18, 2018
1 parent
0e77539
commit 73fcd5a
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
if [ "$1" = --help -o "$1" = -h ] ; then | ||
2>&1 echo "Usage: $0 [ARGS...]" | ||
2>&1 echo "ARGS will be passed to nix-shell" | ||
exit 1 | ||
fi | ||
|
||
nix-shell --pure "$@" --command "$(cat <<'EOF' | ||
mkdir -p tmp | ||
export NIX_BUILD_TOP="$PWD/tmp" | ||
export TMPDIR="$NIX_BUILD_TOP" | ||
export TEMPDIR="$NIX_BUILD_TOP" | ||
export TMP="$NIX_BUILD_TOP" | ||
export TEMP="$NIX_BUILD_TOP" | ||
export HOME=/homeless-shelter | ||
mkdir -p outputs | ||
for x in $outputs ; do | ||
mkdir -p "outputs/$x" | ||
# Replace the expected output paths with our mutable output paths | ||
# everywhere they appear in the environment | ||
eval "$(set | sed "s@${!x//@/\@}@$PWD/outputs/$x@g")" | ||
done | ||
# We want to overwrite old sources with new ones, but we don't want to | ||
eval "$(typeset -f unpackPhase | head -n -1 ; cat <<'ENDFUNC' | ||
if [ "$sourceRoot" != src ] ; then | ||
cp -aT "$sourceRoot" src | ||
rm -rf "$sourceRoot" | ||
sourceRoot=src | ||
fi | ||
} | ||
ENDFUNC | ||
)" | ||
cd tmp | ||
genericBuild | ||
EOF | ||
)" | ||
|
||
ln -sfT outputs/out result |