Nix: builtins.fetchGit doesn't support the name attribute anymore

Created on 3 Aug 2020  路  6Comments  路  Source: NixOS/nix

With nix-2.3.7 adding the name attribute to a call to builtins.fetchGit correctly results in a store path with the specified name:

nix-instantiate --eval -E 'builtins.fetchGit { name = "foo"; rev = "..."; url = "..."; }'
{ outPath = "/nix/store/...-foo"; rev = "..."; revCount = ...; shortRev = "..."; }

However in nix master (a2842588ec86a0f488a385d453eda86e1f52f05a) this is not supported anymore:

nix-instantiate --eval -E 'builtins.fetchGit { name = "foo"; rev = "..."; url = "..."; }'
error: --- Error ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix-instantiate
unsupported Git input attribute 'name'

Is this as intended?

@edolstra this looks to be related to this FIXME.

bug

Most helpful comment

Let's keep this open, it's strictly speaking a regression.

All 6 comments

Right, fetchers currently don't have a way to specify a name,

Thanks, then I'll just adapt my code and remove the name argument.

Let's keep this open, it's strictly speaking a regression.

While it is a regression, it is also nice to have the same name ("source") for all fetchers. That way, content with the same narHash are also the same store path.

While it is a regression, it is also nice to have the same name ("source") for all fetchers. That way, content with the same narHash are also the same store path.

I agree, and there is also value in having the version of the thing in the name e.g. if you are fetching with a git SHA revision so it's easier to know at a glance what the thing is.

this isn't 100% on topic, but the discussion makes me think the behavior I reported in https://github.com/NixOS/nixpkgs/issues/88039 may have been changed, and that issue may be moot?

Was this page helpful?
0 / 5 - 0 ratings