13 个版本

0.3.7 2023 年 2 月 3 日
0.3.6 2023 年 1 月 24 日
0.2.2 2023 年 1 月 1 日
0.1.1 2022 年 12 月 30 日

#1233命令行工具

Download history 21/week @ 2024-03-11 57/week @ 2024-04-01 4/week @ 2024-04-08 5/week @ 2024-04-15 4/week @ 2024-04-22 15/week @ 2024-04-29 7/week @ 2024-05-06 3/week @ 2024-05-20

388 每月下载量

MPL-2.0 许可证

62KB
1.5K SLoC

nurl

release version deps license ci

从仓库 URL 生成 Nix 拉取调用

$ 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=";
}

支持的拉取器

  • builtins.fetchGit
  • fetchCrate
  • fetchFromBitbucket
  • fetchFromGitHub
  • fetchFromGitLab
  • fetchFromGitea
  • fetchFromGitiles
  • fetchFromRepoOrCz
  • fetchFromSourcehut
  • fetchHex
  • fetchPypi
  • fetchgit
  • fetchhg
  • fetchsvn

用法

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[=<SUBMODULES>]      Fetch submodules instead of using the fetcher's default [possible
                                       values: true, false]
  -f, --fetcher <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 <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 <NIXPKGS>              Path to nixpkgs (in nix) [default: <nixpkgs>]
  -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
                                       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
  -s, --list-sep <SEPARATOR>           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

nix-prefetch 的比较

  • nurl 从 URL 推断拉取器。对于 nix-prefetch,您需要手动选择拉取器并输入参数。
  • nix-prefetch 依赖于 FOD,速度较慢,而 nurl 尝试在可能的情况下使用替代方案。
  • nix-prefetch 支持任意表达式(计划用于 nurl)和文件属性。
  • nix-prefetch 更易配置,并且具有与 nix-build 类似的接口。
  • nurl 具有一些针对生成软件包的专用功能(--indent--list-possible-fetchers)。

变更日志

查看 CHANGELOG.md

依赖项

~6–17MB
~248K SLoC