1{
2 fetchFromRadicle,
3 jq,
4 lib,
5}:
6
7lib.makeOverridable (
8 {
9 revision,
10 postFetch ? "",
11 nativeBuildInputs ? [ ],
12 ...
13 }@args:
14
15 assert lib.assertMsg (
16 !args ? rev && !args ? tag
17 ) "fetchRadiclePatch does not accept `rev` or `tag` arguments.";
18
19 fetchFromRadicle (
20 {
21 nativeBuildInputs = [ jq ] ++ nativeBuildInputs;
22 rev = revision;
23 leaveDotGit = true;
24 postFetch = ''
25 { read -r head; read -r base; } < <(jq -r '.oid, .base' $out/0)
26 git -C $out fetch --depth=1 "$url" "$base" "$head"
27 git -C $out diff "$base" "$head" > patch
28 rm -r $out
29 mv patch $out
30 ${postFetch}
31 '';
32 }
33 // removeAttrs args [
34 "revision"
35 "postFetch"
36 "nativeBuildInputs"
37 "leaveDotGit"
38 ]
39 )
40 // {
41 inherit revision;
42 }
43)