nurl

Generate Nix fetcher calls from repository URLs
console
$ nurl https://github.com/nix-community/patsh v0.2.0 2>/dev/null
fetchFromGitHub {
owner = "nix-community";
repo = "patsh";
rev = "v0.2.0";
hash = "sha256-7HXJspebluQeejKYmVA7sy/F3dtU1gc4eAbKiPexMMA=";
}
Supported Fetchers
- builtins.fetchGit
- fetchCrate
- fetchFromBitbucket
- fetchFromGitHub
- fetchFromGitLab
- fetchFromGitea
- fetchFromGitiles
- fetchFromRepoOrCz
- fetchFromSourcehut
- fetchHex
- fetchPypi
- fetchgit
- fetchhg
- fetchsvn
Usage
```
Usage: nurl [OPTIONS] [URL] [REV]
Arguments:
[URL] URL to the repository to be fetched
[REV] The revision or reference to be fetched
Options:
-S, --submodules[=] Fetch submodules instead of using the fetcher's default [possible
values: true, false]
-f, --fetcher Specify the fetcher function instead of inferring from the
URL [possible values: builtins.fetchGit, fetchCrate,
fetchFromBitbucket, fetchFromGitHub, fetchFromGitLab,
fetchFromGitea, fetchFromGitiles, fetchFromRepoOrCz,
fetchFromSourcehut, fetchHex, fetchPypi, fetchgit, fetchhg,
fetchsvn]
-F, --fallback The fetcher to fall back to when nurl fails to infer it from
the URL [default: fetchgit] [possible values:
builtins.fetchGit, fetchCrate, fetchFromBitbucket,
fetchFromGitHub, fetchFromGitLab, fetchFromGitea,
fetchFromGitiles, fetchFromRepoOrCz, fetchFromSourcehut,
fetchHex, fetchPypi, fetchgit, fetchhg, fetchsvn]
-n, --nixpkgs Path to nixpkgs (in nix) [default: ]
-i, --indent Extra indentation (in number of spaces) [default: 0]
-H, --hash Only output the hash
-j, --json Output in json format
-p, --parse Parse the url without fetching the hash, output in json
format
-a, --arg Additional arguments to pass to the fetcher
-A, --arg-str Same as --arg, but accepts strings instead Nix expressions
-o, --overwrite Overwrite arguments in the final output, not taken into
consideration when fetching the hash
-O, --overwrite-str Same as --overwrite, but accepts strings instead Nix
expressions
-l, --list-fetchers List all available fetchers
-L, --list-possible-fetchers List all fetchers that can be generated without --fetcher
-s, --list-sep Print out the listed fetchers with the specified separator,
only used when --list-fetchers or --list-possible-fetchers is
specified
-h, --help Print help
-V, --version Print version
```
nurl
infers the fetcher from the URL. For nix-prefetch
, you need to pick the fetcher and supply the arguments manually.
nix-prefetch
relies on FOD which is slow, nurl
tries to use alternatives when possible.
nix-prefetch
supports arbitrary expressions (planned for nurl
) and file attributes.
nix-prefetch
is more configurable and has an interface similar to nix-build
.
nurl
has some nice features dedicated to generated packages (--indent
, --list-possible-fetchers
).
Changelog
See CHANGELOG.md