Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
builtins.fetchGit: use same name as nix-prefetch-git
When using npins with (generic, i.e. non-github) git repositories, we currently have the issue of having to download these twice: once while doing `npins add git ...`, and then a second time when evaluating the source attribute in Nix. The source of this is that nix-prefetch-git, which we use to get the hash, sets as name for the store path it produces a name derived from the url; this behaviour is not configurable [1]. In contrast, builtins.fetchGit sets the name as "source" by default. The nixpkgs fetcher uses a nix implementation of the same logic to derive the desired name in nix [2]. This commit adds a function which does the same, derived from the one in Nixpkgs, but tweaked to only use builtin functions, and uses it to set an appropriate name for the git fetcher. [1] https://github.com/NixOS/nixpkgs/blob/c215fb18dc1c4ef927c773078d2365fc559365c5/pkgs/build-support/fetchgit/nix-prefetch-git#L142 [2] https://github.com/NixOS/nixpkgs/blob/2116a1123122d639b7c69e47284e4b35198c3fa6/pkgs/build-support/fetchgit/default.nix#L2
- Loading branch information