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

force fetchGit allRefs when a dependency is specified with "rev" #243

Merged
merged 2 commits into from
Jun 12, 2022

Conversation

goertzenator
Copy link
Contributor

The usage of git "rev" dependencies in Cargo implies that the rev
will be found regardless of ref. This is currently not true in naersk;
the following dependency fails:

usbfs = {git = "https://github.com/goertzenator/usbfs-rs", rev = "7c35b46e41ad76f838cd99b493f9337f475b5b70"}

The usage of git "rev" dependencies in Cargo implies that the rev
will be found regardless of ref.  This is currently not true in naersk;
the following dependency fails:

usbfs = {git = "https://github.com/goertzenator/usbfs-rs", rev = "7c35b46e41ad76f838cd99b493f9337f475b5b70"}
@Patryk27
Copy link
Contributor

Patryk27 commented Jun 4, 2022

Hi 🙂

Thanks for this pull request; we've already considered doing that in the past (#211), but eventually settled on a dedicated option, because allRefs was not supported by Nix 2.3 (which was still pretty prevalent at the time).

I see NixOS 22.05 ships with Nix 2.8 and https://nixos.org/download.html provides Nix 2.9, so I think it's time to revisit that decision - but, just in case, could you introduce a version check there? (something like https://github.com/nix-community/poetry2nix/blob/57b1515c0b053eece543605414ebb104e39c247a/mk-poetry-dep.nix#L174 should do it)

@Patryk27 Patryk27 closed this Jun 4, 2022
@Patryk27
Copy link
Contributor

Patryk27 commented Jun 4, 2022

whoopsie, missclick!

@Patryk27 Patryk27 reopened this Jun 4, 2022
@goertzenator
Copy link
Contributor Author

Thanks for the response. I will add the suggested change in the next few days.

@goertzenator
Copy link
Contributor Author

Additional reference information on this topic: NixOS/nix#5128

Prevent use of allRefs when nix <2.4 is in use.
nix <2.4 does not accept the `allRefs` flag, but has `allRefs` behavior
by default.  Note that this goes beyond the the initial intent of this
PR because it enables naersk's `gitAllRefs` flag to work on nix <2.4.
Copy link
Contributor

@Patryk27 Patryk27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks neat, thanks!

@Patryk27 Patryk27 merged commit cddffb5 into nix-community:master Jun 12, 2022
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.

2 participants