-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
builtins.fetchGit
’s return value should have a url
attribute
#11222
Comments
Sources are generally best fetched with a fixed output derivation, such as produced by We do make exceptions for sources that contain Nix expressions we need to evaluate (to avoid blocking on builds (IFD); a reason why Flakes also uses this mechanism) or when the remote requires authentication. I think the reason the URL is not present is to avoid accidental dependencies on "implementation details", but personally I'm not opposed to adding it. |
Hmmm. I would use (builtins.fetchGit {
url = "https://github.com/microsoft/vcpkg";
ref = "refs/tags/2024.07.12";
}).rev evaluates to (pkgs.fetchgit {
url = "https://github.com/microsoft/vcpkg";
rev = "refs/tags/2024.07.12";
}).rev evaluates to Also, why does one of the two functions produce a fixed output derivation but not the other? |
From Nixpkgs Manual § Fetchers:
|
builtins.fetcGit
’s return value should have a url
attributebuiltins.fetchGit
’s return value should have a url
attribute
Is your feature request related to a problem? Please describe.
Create a file named
package.nix
that contains this:Create a file named
default.nix
that contains this:Try running
nix-update
:nix-shell -p nix-update --run 'nix-update cmark'
It will fail with this error:
Describe the solution you'd like
It would be nice if the return value of
builtins.fetchGit
had aurl
attribute. That would allow downstream processors of Nix expressions to do things with the Git repo’s URL.Describe alternatives you've considered
Here’s a workaround:
Additional context
I’m currently working on a nixpkgs PR that’s related to vcpkg. In order for certain features of vcpkg to work properly, we need to know the commit hash for the version of vcpkg that we’re building. I proposed using
builtins.fetchGit
for this purpose because its return value has arev
attribute that contains the commit hash. Another contributor was concerned that automatic updates might stop working if we switched tobuiltins.fetchGit
. I’m submitting this feature request because I want automatic updates to work regardless of whether or not we’re usingbuiltins.fetchGit
.Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: