addNuGetDeps: move TMPDIR handling out of fetch-deps
We now handle creating TMPDIR and setting the working directory outide of nix-shell. This allows nix-shell to set NIX_BUILD_TOP correctly.
This commit is contained in:
parent
e7fb591c92
commit
c693cb8ec6
@ -79,7 +79,12 @@ attrs
|
||||
|
||||
in
|
||||
writeShellScript "${finalPackage.name}-fetch-deps" ''
|
||||
NIX_BUILD_SHELL="${runtimeShell}" exec ${nix}/bin/nix-shell \
|
||||
set -eu
|
||||
export TMPDIR
|
||||
TMPDIR=$(mktemp -d -t fetch-deps-${finalPackage.name}.XXXXXX)
|
||||
trap 'chmod -R +w "$TMPDIR" && rm -fr "$TMPDIR"' EXIT
|
||||
cd "$TMPDIR"
|
||||
NIX_BUILD_SHELL="${runtimeShell}" {nix}/bin/nix-shell \
|
||||
--pure --run 'source "${innerScript}"' "${drv}"
|
||||
'';
|
||||
};
|
||||
|
@ -1,20 +1,18 @@
|
||||
set -e
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
trap 'chmod -R +w "$tmp" && rm -fr "$tmp"' EXIT
|
||||
|
||||
HOME=$tmp/.home
|
||||
export TMPDIR="$tmp/.tmp"
|
||||
mkdir "$HOME" "$TMPDIR"
|
||||
cd "$tmp"
|
||||
HOME=$NIX_BUILD_TOP/home
|
||||
mkdir "$HOME"
|
||||
|
||||
export NIX_SSL_CERT_FILE=@cacert@/etc/ssl/certs/ca-bundle.crt
|
||||
|
||||
genericBuild
|
||||
|
||||
depsFile=$(realpath "${1:-@defaultDepsFile@}")
|
||||
tmpFile="$tmp"/deps.nix
|
||||
echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n" > "$tmpFile"
|
||||
@nugetToNix@/bin/nuget-to-nix "${NUGET_PACKAGES%/}" >> "$tmpFile"
|
||||
mv "$tmpFile" "$depsFile"
|
||||
|
||||
(
|
||||
echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n"
|
||||
@nugetToNix@/bin/nuget-to-nix "${NUGET_PACKAGES%/}"
|
||||
) > deps.nix
|
||||
|
||||
mv deps.nix "$depsFile"
|
||||
echo "Succesfully wrote lockfile to $depsFile"
|
||||
|
Loading…
Reference in New Issue
Block a user