mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
nix-prefetch-git: respect NETRC
This script needs to support being run both as part of a `fetchgit` derivation and as a standalone, command-line tool. The use of `$NIX_BUILD_TOP` only works when used in `fetchgit` but not when invoked as a standalone tool. Instead we try to respect `$NETRC` so that the command-line invocation behaves more like standard tools and the `fetchgit` derivation can explicitly set `$NETRC` when `netrcPhase` is used to avoid all ambiguity.
This commit is contained in:
parent
99298c3da0
commit
3a99d1b642
|
@ -90,6 +90,7 @@ stdenvNoCC.mkDerivation {
|
||||||
${netrcPhase}
|
${netrcPhase}
|
||||||
# required that git uses the netrc file
|
# required that git uses the netrc file
|
||||||
mv {,.}netrc
|
mv {,.}netrc
|
||||||
|
export NETRC=$PWD/.netrc
|
||||||
export HOME=$PWD
|
export HOME=$PWD
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -425,8 +425,8 @@ fi
|
||||||
|
|
||||||
tmpHomePath="$(mktemp -d "${TMPDIR:-/tmp}/nix-prefetch-git-tmp-home-XXXXXXXXXX")"
|
tmpHomePath="$(mktemp -d "${TMPDIR:-/tmp}/nix-prefetch-git-tmp-home-XXXXXXXXXX")"
|
||||||
exit_handlers+=(remove_tmpHomePath)
|
exit_handlers+=(remove_tmpHomePath)
|
||||||
|
ln -s "${NETRC:-$HOME/.netrc}" "$tmpHomePath/.netrc"
|
||||||
HOME="$tmpHomePath"
|
HOME="$tmpHomePath"
|
||||||
ln -s "$NIX_BUILD_TOP/.netrc" "$HOME/"
|
|
||||||
unset XDG_CONFIG_HOME
|
unset XDG_CONFIG_HOME
|
||||||
export GIT_CONFIG_NOSYSTEM=1
|
export GIT_CONFIG_NOSYSTEM=1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue