Fetch URLs, print hashes. No Nix store, parallel.
- Configurable worker pool (default: 16 concurrent downloads)
- Retries with exponential backoff (3 attempts by default)
- Fail-fast mode to bail on first error
- Zero dependencies, single static binary
Run directly without installing:
nix run github:z1-0/nix-bulkfetch-urlOr install permanently:
nix profile install github:z1-0/nix-bulkfetch-urlAdd to your flake:
inputs.nix-bulkfetch-url.url = "github:z1-0/nix-bulkfetch-url";NixOS system-wide (in configuration.nix):
environment.systemPackages = [
inputs.nix-bulkfetch-url.packages.${pkgs.system}.default
];Home Manager (in home.nix):
home.packages = [
inputs.nix-bulkfetch-url.packages.${pkgs.system}.default
];The binary itself has no Go dependencies. It is statically linked. Archive unpacking uses external tools:
| Format | Tool |
|---|---|
.tar.gz, .tgz |
tar |
.tar.xz, .txz |
tar |
.tar.bz2, .tbz2 |
tar |
.tar.zst, .tzst |
tar + zstd |
.tar.lzma, .tlzma |
tar |
.tar.lz, .tlz |
tar + lzip |
.tar.lz4, .tlz4 |
tar + lz4 |
.tar.lzo, .tlzo |
tar + lzop |
.tar.Z, .tZ |
tar + compress |
.zip |
unzip |
Feed URLs via stdin, one per line. Lines starting with # and empty lines are ignored.
echo "https://example.com/archive.tar.gz" | nix-bulkfetch-url| Flag | Default | Description |
|---|---|---|
-j |
16 |
Concurrent workers |
--type |
sha256 |
Hash algorithm: md5, sha1, sha256, sha512, blake3 |
--format |
sri |
Output format: base16, base32, base64, sri |
--unpack |
false |
Unpack archive and compute NAR hash |
--json |
false |
Output as JSON |
--timeout |
300 |
Download timeout (seconds) |
--fail-fast |
false |
Exit on first error |
| Code | Meaning |
|---|---|
0 |
All URLs succeeded |
1 |
Some failed, some succeeded |
2 |
Nothing succeeded (or no input) |
echo "https://github.com/user/repo/archive/v1.0.0.tar.gz" | nix-bulkfetch-urlcat urls.txt | nix-bulkfetch-url -j 8 --jsonDownloads each archive, extracts it, and computes a NAR hash on the unpacked directory. That is the same hash you would put in a Nix derivation's sha256 field.
cat urls.txt | nix-bulkfetch-url --unpackgrep -oP 'https://[^\s"]+\.tar\.gz' packages.nix | nix-bulkfetch-url --type blake3cat urls.txt | nix-bulkfetch-url --json | jq '.[] | select(.error == null)'- Reads URLs from stdin
- Downloads them concurrently using a pool of N workers
- For each URL: fetches to a temp directory, unpacks if
--unpackis set, then hashes withnix-hash - Prints one hash per line (or a JSON array with
--json)