Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to using the installed git and add environment variables NP_GIT #28

Merged
merged 1 commit into from
Jan 23, 2022

Conversation

ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Jan 21, 2022

This change make nix-portable install and override git by default, unless users specify the path to git executable with the environment variable NP_GIT.

When nix-portable runs in an environment where the Git version is not compatible (v1.x, etc.), flake-related commands would error out:

$ nix-portable nix flake info
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
error: --- Error ---------------------------------------- nix
program 'git' failed with exit code 129

If applied, the error will be fixed:

$ nix-portable nix flake info
Resolved URL:  git+file:///afs/cern.ch/work/y/yuehshun/private/Projects/DavHau/nix-portable
Locked URL:    git+file:///afs/cern.ch/work/y/yuehshun/private/Projects/DavHau/nix-portable?ref=force-install-git&rev=b517129db9317af9ace7283b14a11a0ef73e2dbd
Path:          /nix/store/j75mrqgbz28kjdc6xms7s5cgh50qbf5x-source
Revision:      b517129db9317af9ace7283b14a11a0ef73e2dbd
Revisions:     52
Last modified: 2022-01-21 03:22:54

@ShamrockLee
Copy link
Contributor Author

Added some documentation.

@DavHau
Copy link
Owner

DavHau commented Jan 22, 2022

If some git installations cause problems, maybe we should enforce the git installation by default?
How about we remove all options NP_MINIMAL, NP_GITDIR, NP_INSTALLGIT.
... And instead have only NP_GIT.

NP_GIT can be:

  • unset: use git from nixpkgs
  • /path/to/git: use git binary from specified path

Only if NP_GIT is specified, the git installation is omitted. In any other case, git from nixpkgs is used.

I think the user experience would be better if there is only one variable to understand.
How do you think about this?

@ShamrockLee ShamrockLee changed the title Add environment variable NP_INSTALLGIT and NP_GITDIR Add environment variables NP_INSTALLGIT and NP_GITDIR Jan 22, 2022
@ShamrockLee
Copy link
Contributor Author

@DavHau Sounds great, but is it okay to add path/to/executable to PATH?

@ShamrockLee
Copy link
Contributor Author

Done.

@ShamrockLee ShamrockLee changed the title Add environment variables NP_INSTALLGIT and NP_GITDIR Default to use the installed git and add environment variables NP_GIT Jan 22, 2022
@ShamrockLee ShamrockLee changed the title Default to use the installed git and add environment variables NP_GIT Default to using the installed git and add environment variables NP_GIT Jan 22, 2022
@DavHau DavHau merged commit a8aae6f into DavHau:master Jan 23, 2022
@ShamrockLee ShamrockLee deleted the force-install-git branch January 23, 2022 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants