Generate Nix fetcher calls from repository URLs [maintainer=@figsoda]
Go to file
2023-01-03 14:16:29 -05:00
.github generate man page and completions 2022-12-30 15:39:27 -05:00
src fix fetchhg 2023-01-03 14:15:45 -05:00
tests fix fetchhg 2023-01-03 14:15:45 -05:00
.gitignore add flake 2022-12-30 10:23:21 -05:00
build.rs generate man page and completions 2022-12-30 15:39:27 -05:00
Cargo.lock test with trycmd 2023-01-03 13:34:06 -05:00
Cargo.toml test with trycmd 2023-01-03 13:34:06 -05:00
CHANGELOG.md bump version 2023-01-01 22:43:22 -05:00
flake.lock add flake 2022-12-30 10:23:21 -05:00
flake.nix disable tests in flake 2023-01-03 14:16:29 -05:00
LICENSE initial commit 2022-12-29 13:02:55 -05:00
README.md Revert "remove --list-possible-fetchers since all fetchers are possible" 2023-01-02 15:06:10 -05:00
rustfmt.toml initial commit 2022-12-29 13:02:55 -05:00

nurl

release version deps license ci

Generate Nix fetcher calls from repository URLs

$ 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

  • fetchFromBitbucket
  • fetchFromGitHub
  • fetchFromGitLab
  • fetchFromGitea
  • fetchFromGitiles
  • fetchFromRepoOrCz
  • fetchFromSourcehut
  • fetchgit
  • fetchhg (requires --fetcher fetchhg)

Usage

Usage: nurl [OPTIONS] [URL] [REV]

Arguments:
  [URL]  URL to the repository to be fetched
  [REV]  the revision or reference to be fetched

Options:
  -f, --fetcher <FETCHER>              specify the fetcher function instead of inferring from the
                                       URL [possible values: fetchFromBitbucket, fetchFromGitHub,
                                       fetchFromGitLab, fetchFromGitea, fetchFromGitiles,
                                       fetchFromRepoOrCz, fetchFromSourcehut, fetchgit, fetchhg]
  -i, --indent <INDENT>                extra indentation (in number of spaces) [default: 0]
  -j, --json                           output in json format
  -a, --arg <NAME> <EXPR>              additional arguments to pass to the fetcher
  -A, --arg-str <NAME> <STRING>        same as --arg, but accepts strings instead Nix expressions
  -o, --overwrite <NAME> <EXPR>        overwrite arguments in the final output, not taken into
                                       consideration when fetching the hash
  -O, --overwrite-str <NAME> <STRING>  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
  -h, --help                           Print help information
  -V, --version                        Print version information

Comparison to nix-prefetch

  • 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