fetchRadiclePatch: init (#438646)

Changed files
+62
doc
pkgs
build-support
fetchradiclepatch
top-level
+15
doc/build-helpers/fetchers.chapter.md
···
}
```
## `requireFile` {#requirefile}
`requireFile` allows requesting files that cannot be fetched automatically, but whose content is known.
···
}
```
+
## `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.
+3
doc/redirects.json
···
"fetchfromradicle": [
"index.html#fetchfromradicle"
],
"requirefile": [
"index.html#requirefile"
],
···
"fetchfromradicle": [
"index.html#fetchfromradicle"
],
+
"fetchradiclepatch": [
+
"index.html#fetchradiclepatch"
+
],
"requirefile": [
"index.html#requirefile"
],
+43
pkgs/build-support/fetchradiclepatch/default.nix
···
···
+
{
+
fetchFromRadicle,
+
jq,
+
lib,
+
}:
+
+
lib.makeOverridable (
+
{
+
revision,
+
postFetch ? "",
+
nativeBuildInputs ? [ ],
+
...
+
}@args:
+
+
assert lib.assertMsg (
+
!args ? rev && !args ? tag
+
) "fetchRadiclePatch does not accept `rev` or `tag` arguments.";
+
+
fetchFromRadicle (
+
{
+
nativeBuildInputs = [ jq ] ++ nativeBuildInputs;
+
rev = revision;
+
leaveDotGit = true;
+
postFetch = ''
+
{ read -r head; read -r base; } < <(jq -r '.oid, .base' $out/0)
+
git -C $out fetch --depth=1 "$url" "$base" "$head"
+
git -C $out diff "$base" "$head" > patch
+
rm -r $out
+
mv patch $out
+
${postFetch}
+
'';
+
}
+
// removeAttrs args [
+
"revision"
+
"postFetch"
+
"nativeBuildInputs"
+
"leaveDotGit"
+
]
+
)
+
// {
+
inherit revision;
+
}
+
)
+1
pkgs/top-level/all-packages.nix
···
fetchFromRepoOrCz = callPackage ../build-support/fetchrepoorcz { };
fetchFromRadicle = callPackage ../build-support/fetchradicle { };
fetchgx = callPackage ../build-support/fetchgx { };
···
fetchFromRepoOrCz = callPackage ../build-support/fetchrepoorcz { };
fetchFromRadicle = callPackage ../build-support/fetchradicle { };
+
fetchRadiclePatch = callPackage ../build-support/fetchradiclepatch { };
fetchgx = callPackage ../build-support/fetchgx { };