Skip to content

Commit

Permalink
Add environment variable NP_INSTALLGIT and NP_GITDIR
Browse files Browse the repository at this point in the history
  • Loading branch information
ShamrockLee committed Jan 21, 2022
1 parent 55feedf commit 7487720
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ The following environment variables are optional and can be used to override the
```
NP_DEBUG (1 = debug msgs; 2 = 'set -e' for nix-portable)
NP_MINIMAL do not automatically install git
NP_INSTALLGIT force nix-portable to use the installed git.
NP_GITDIR specify the directory containing the git executable.
(The above two are useful in environments with incompalible Git)
NP_LOCATION where to put the `.nix-portable` dir. (defaults to `$HOME`)
NP_RUNTIME which runtime to use (must be 'bwrap' or 'proot')
NP_BWRAP specify the path to the bwrap executable to use
Expand Down
14 changes: 12 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ let
### detecting existing git installation
if [ -n "\$NP_MINIMAL" ]; then
if [ -n "\$NP_MINIMAL" ] || [ -n "\$NP_GITDIR" ]; then
doInstallGit=false
elif [ -n "\$NP_INSTALLGIT" ]; then
doInstallGit=true
else
existingGit="\$(PATH="\$PATH_OLD:\$PATH" which git 2>&3)" || existingGit=
Expand Down Expand Up @@ -454,7 +456,15 @@ let
fi
# add git if necessary
\$doInstallGit && export PATH="\$PATH:${git.out}/bin"
if \$doInstallGit; then
if [ -n "\$NP_INSTALLGIT" ]; then
export PATH="${git.out}/bin:\$PATH"
else
export PATH="\$PATH:${git.out}/bin"
fi
elif [ -n "\$NP_GITDIR" ]; then
export PATH="\$NP_GITDIR:\$PATH"
fi
Expand Down

0 comments on commit 7487720

Please sign in to comment.