Home Explore Blog Models CI



nixpkgs

14th chunk of `doc/build-helpers/fetchers.chapter.md`
d9030037111ad65dbaf17a4bec74b35b1758d91c90052e790000000100000add
This is used with Gitiles repositories. The arguments expected are similar to `fetchgit`.

## `fetchFromBitbucket` {#fetchfrombitbucket}

This is used with BitBucket repositories. The arguments expected are very similar to `fetchFromGitHub` above.

## `fetchFromSavannah` {#fetchfromsavannah}

This is used with Savannah repositories. The arguments expected are very similar to `fetchFromGitHub` above.

## `fetchFromRepoOrCz` {#fetchfromrepoorcz}

This is used with repo.or.cz repositories. The arguments expected are very similar to `fetchFromGitHub` above.

## `fetchFromSourcehut` {#fetchfromsourcehut}

This is used with sourcehut repositories. Similar to `fetchFromGitHub` above,
it expects `owner`, `repo`, `rev` and `hash`, but don't forget the tilde (~)
in front of the username! Expected arguments also include `vc` ("git" (default)
or "hg"), `domain` and `fetchSubmodules`.

If `fetchSubmodules` is `true`, `fetchFromSourcehut` uses `fetchgit`
or `fetchhg` with `fetchSubmodules` or `fetchSubrepos` set to `true`,
respectively. Otherwise, the fetcher uses `fetchzip`.

## `fetchFromRadicle` {#fetchfromradicle}

This is used with Radicle repositories. The arguments expected are similar to `fetchgit`.

Requires a `seed` argument (e.g. `seed.radicle.xyz` or `rosa.radicle.xyz`) and a `repo` argument
(the repository id *without* the `rad:` prefix). Also accepts an optional `node` argument which
contains the id of the node from which to fetch the specified ref. If `node` is `null` (the
default), a canonical ref is fetched instead.

```nix
fetchFromRadicle {
  seed = "seed.radicle.xyz";
  repo = "z3gqcJUoA1n9HaHKufZs5FCSGazv5"; # heartwood
  tag = "releases/1.3.0";
  hash = "sha256-4o88BWKGGOjCIQy7anvzbA/kPOO+ZsLMzXJhE61odjw=";
}
```

## `fetchRadiclePatch` {#fetchradiclepatch}

`fetchRadiclePatch` works very similarly to `fetchFromRadicle` with almost the same arguments
expected. However, instead of a `rev` or `tag` argument, a `revision` argument is expected, which
contains the full revision id of the Radicle patch to fetch.

```nix
fetchRadiclePatch {
  seed = "rosa.radicle.xyz";
  repo = "z4V1sjrXqjvFdnCUbxPFqd5p4DtH5"; # radicle-explorer
  revision = "d97d872386c70607beda2fb3fc2e60449e0f4ce4"; # patch: d77e064
  hash = "sha256-ttnNqj0lhlSP6BGzEhhUOejKkkPruM9yMwA5p9Di4bk=";
}
```

## `requireFile` {#requirefile}

`requireFile` allows requesting files that cannot be fetched automatically, but whose content is known.
This is a useful last-resort workaround for license restrictions that prohibit redistribution, or for downloads that are only accessible after authenticating interactively in a browser.
If the requested file is present in the Nix store, the resulting derivation will not be built, because its expected output is already available.

Title: Specialized Source Fetchers and `requireFile`
Summary
This document outlines several platform-specific fetcher functions. `fetchFromBitbucket`, `fetchFromSavannah`, and `fetchFromRepoOrCz` are introduced, all using arguments similar to `fetchFromGitHub`. `fetchFromSourcehut` expects `owner`, `repo`, `rev`, `hash` (with a tilde for username), `vc` (git or hg), `domain`, and `fetchSubmodules`; it uses `fetchgit`/`fetchhg` for submodules and `fetchzip` otherwise. `fetchFromRadicle` is detailed for Radicle repositories, requiring `seed` and `repo` (repository ID) and optionally `node`. A related function, `fetchRadiclePatch`, is for fetching specific Radicle patches, using a `revision` argument instead of `rev` or `tag`. Finally, `requireFile` is presented as a mechanism to include files that cannot be automatically fetched due to restrictions or interactive authentication, allowing the system to use pre-existing files from the Nix store.