2022-12-29 21:01:00 +03:00
|
|
|
# nurl
|
|
|
|
|
|
|
|
[![release](https://img.shields.io/github/v/release/nix-community/nurl?logo=github&style=flat-square)](https://github.com/nix-community/nurl/releases)
|
|
|
|
[![version](https://img.shields.io/crates/v/nurl?logo=rust&style=flat-square)][crate]
|
|
|
|
[![deps](https://deps.rs/repo/github/nix-community/nurl/status.svg?style=flat-square&compact=true)](https://deps.rs/repo/github/nix-community/nurl)
|
|
|
|
[![license](https://img.shields.io/badge/license-MPL--2.0-blue?style=flat-square)](https://www.mozilla.org/en-US/MPL/2.0)
|
|
|
|
[![ci](https://img.shields.io/github/actions/workflow/status/nix-community/nurl/ci.yml?label=ci&logo=github-actions&style=flat-square)](https://github.com/nix-community/nurl/actions?query=workflow:ci)
|
|
|
|
|
2022-12-30 05:04:19 +03:00
|
|
|
Generate Nix fetcher calls from repository URLs
|
|
|
|
|
2023-01-01 04:04:34 +03:00
|
|
|
```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=";
|
|
|
|
}
|
2022-12-29 21:01:00 +03:00
|
|
|
```
|
|
|
|
|
2023-01-01 04:04:34 +03:00
|
|
|
## Supported Fetchers
|
2022-12-29 21:01:00 +03:00
|
|
|
|
2023-01-13 18:38:24 +03:00
|
|
|
- fetchCrate
|
2023-01-01 04:20:02 +03:00
|
|
|
- fetchFromBitbucket
|
2023-01-01 04:04:34 +03:00
|
|
|
- fetchFromGitHub
|
|
|
|
- fetchFromGitLab
|
|
|
|
- fetchFromGitea
|
|
|
|
- fetchFromGitiles
|
|
|
|
- fetchFromRepoOrCz
|
|
|
|
- fetchFromSourcehut
|
2023-01-13 18:38:24 +03:00
|
|
|
- fetchHex
|
2023-01-01 04:04:34 +03:00
|
|
|
- fetchgit
|
2023-01-05 02:15:44 +03:00
|
|
|
- fetchhg
|
|
|
|
- fetchsvn
|
2022-12-29 21:01:00 +03:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2022-12-30 05:04:19 +03:00
|
|
|
```
|
2023-01-01 04:04:34 +03:00
|
|
|
Usage: nurl [OPTIONS] [URL] [REV]
|
2022-12-30 05:04:19 +03:00
|
|
|
|
|
|
|
Arguments:
|
2023-01-01 04:04:34 +03:00
|
|
|
[URL] URL to the repository to be fetched
|
2023-01-13 18:38:24 +03:00
|
|
|
[REV] The revision or reference to be fetched
|
2022-12-30 05:04:19 +03:00
|
|
|
|
|
|
|
Options:
|
2023-01-13 18:38:24 +03:00
|
|
|
-f, --fetcher <FETCHER> Specify the fetcher function instead of inferring from the
|
|
|
|
URL [possible values: fetchCrate, fetchFromBitbucket,
|
|
|
|
fetchFromGitHub, fetchFromGitLab, fetchFromGitea,
|
|
|
|
fetchFromGitiles, fetchFromRepoOrCz, fetchFromSourcehut,
|
|
|
|
fetchHex, fetchgit, fetchhg, fetchsvn]
|
|
|
|
-i, --indent <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 <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
|
2023-01-02 04:24:52 +03:00
|
|
|
consideration when fetching the hash
|
2023-01-13 18:38:24 +03:00
|
|
|
-O, --overwrite-str <NAME> <STRING> Same as --overwrite, but accepts strings instead Nix
|
2023-01-02 04:24:52 +03:00
|
|
|
expressions
|
|
|
|
-l, --list-fetchers List all available fetchers
|
2023-01-02 23:06:10 +03:00
|
|
|
-L, --list-possible-fetchers List all fetchers that can be generated without --fetcher
|
2023-01-03 22:38:38 +03:00
|
|
|
-s, --list-sep <SEPARATOR> Print out the listed fetchers with the specified separator,
|
|
|
|
only used when --list-fetchers or --list-possible-fetchers is
|
|
|
|
specified
|
2023-01-13 18:38:24 +03:00
|
|
|
-h, --help Print help information
|
2023-01-02 04:24:52 +03:00
|
|
|
-V, --version Print version information
|
2022-12-30 05:04:19 +03:00
|
|
|
```
|
|
|
|
|
2023-01-01 06:30:54 +03:00
|
|
|
## Comparison to [nix-prefetch](https://github.com/msteen/nix-prefetch)
|
|
|
|
|
|
|
|
- `nurl` infers the fetcher from the URL. For `nix-prefetch`, you need to pick the fetcher and supply the arguments manually.
|
2023-01-01 06:34:56 +03:00
|
|
|
- `nix-prefetch` relies on FOD which is slow, `nurl` tries to use alternatives when possible.
|
2023-01-01 06:30:54 +03:00
|
|
|
- `nix-prefetch` supports arbitrary expressions (planned for `nurl`) and file attributes.
|
|
|
|
- `nix-prefetch` is more configurable and has an interface similar to `nix-build`.
|
2023-01-02 23:06:10 +03:00
|
|
|
- `nurl` has some nice features dedicated to generated packages (`--indent`, `--list-possible-fetchers`).
|
2023-01-01 06:30:54 +03:00
|
|
|
|
2022-12-29 21:01:00 +03:00
|
|
|
## Changelog
|
|
|
|
|
2023-01-01 04:04:34 +03:00
|
|
|
See [CHANGELOG.md](CHANGELOG.md)
|
2022-12-29 21:01:00 +03:00
|
|
|
|
|
|
|
[crate]: https://crates.io/crates/nurl
|