1{ lib
2, fetchFromSourcehut
3, buildPythonPackage
4, buildGoModule
5, python
6, srht
7, pygit2
8, scmsrht
9}:
10let
11 version = "0.72.8";
12
13 src = fetchFromSourcehut {
14 owner = "~sircmpwn";
15 repo = "git.sr.ht";
16 rev = version;
17 sha256 = "sha256-AB2uzajO5PtcpJfbOOTfuDFM6is5K39v3AZJ1hShRNc=";
18 };
19
20 buildShell = src: buildGoModule {
21 inherit src version;
22 pname = "gitsrht-shell";
23 vendorSha256 = "sha256-aqUFICp0C2reqb2p6JCPAUIRsxzSv0t9BHoNWrTYfqk=";
24 };
25
26 buildDispatcher = src: buildGoModule {
27 inherit src version;
28 pname = "gitsrht-dispatcher";
29 vendorSha256 = "sha256-qWXPHo86s6iuRBhRMtmD5jxnAWKdrWHtA/iSUkdw89M=";
30 };
31
32 buildKeys = src: buildGoModule {
33 inherit src version;
34 pname = "gitsrht-keys";
35 vendorSha256 = "1d94cqy7x0q0agwg515xxsbl70b3qrzxbzsyjhn1pbyj532brn7f";
36 };
37
38 buildUpdateHook = src: buildGoModule {
39 inherit src version;
40 pname = "gitsrht-update-hook";
41 vendorSha256 = "0fwzqpjv8x5y3w3bfjd0x0cvqjjak23m0zj88hf32jpw49xmjkih";
42 };
43
44 updateHook = buildUpdateHook "${src}/gitsrht-update-hook";
45
46in
47buildPythonPackage rec {
48 inherit src version;
49 pname = "gitsrht";
50
51 nativeBuildInputs = srht.nativeBuildInputs;
52
53 propagatedBuildInputs = [
54 srht
55 pygit2
56 scmsrht
57 ];
58
59 preBuild = ''
60 export PKGVER=${version}
61 export SRHT_PATH=${srht}/${python.sitePackages}/srht
62 '';
63
64 postInstall = ''
65 mkdir -p $out/bin
66 cp ${buildShell "${src}/gitsrht-shell"}/bin/gitsrht-shell $out/bin/gitsrht-shell
67 cp ${buildDispatcher "${src}/gitsrht-dispatch"}/bin/gitsrht-dispatch $out/bin/gitsrht-dispatch
68 cp ${buildKeys "${src}/gitsrht-keys"}/bin/gitsrht-keys $out/bin/gitsrht-keys
69 cp ${updateHook}/bin/gitsrht-update-hook $out/bin/gitsrht-update-hook
70 '';
71 passthru = {
72 inherit updateHook;
73 };
74
75 meta = with lib; {
76 homepage = "https://git.sr.ht/~sircmpwn/git.sr.ht";
77 description = "Git repository hosting service for the sr.ht network";
78 license = licenses.agpl3;
79 maintainers = with maintainers; [ eadwu ];
80 };
81}