jenkins: 2.479.3 -> 2.492.1
[NixPkgs.git] / pkgs / applications / version-management / sourcehut / git.nix
blob887dac1a7070607fbdcdb6c49be26f933c745683
2   lib,
3   fetchFromSourcehut,
4   buildGoModule,
5   buildPythonPackage,
6   python,
7   srht,
8   scmsrht,
9   pygit2,
10   minio,
11   pythonOlder,
12   unzip,
13   pip,
14   setuptools,
16 let
17   version = "0.85.9";
18   gqlgen = import ./fix-gqlgen-trimpath.nix {
19     inherit unzip;
20     gqlgenVersion = "0.17.42";
21   };
23   src = fetchFromSourcehut {
24     owner = "~sircmpwn";
25     repo = "git.sr.ht";
26     rev = version;
27     hash = "sha256-tmbBw6x3nqN9nRIR3xOXQ+L5EACXLQYLXQYK3lsOsAI=";
28   };
30   gitApi = buildGoModule (
31     {
32       inherit src version;
33       pname = "gitsrht-api";
34       modRoot = "api";
35       vendorHash = "sha256-4KwnUi6ILUagMDXzuBG9CRT2N8uyjvRM74TwJqIzicc=";
36     }
37     // gqlgen
38   );
40   gitDispatch = buildGoModule (
41     {
42       inherit src version;
43       pname = "gitsrht-dispatch";
44       modRoot = "gitsrht-dispatch";
45       vendorHash = "sha256-4KwnUi6ILUagMDXzuBG9CRT2N8uyjvRM74TwJqIzicc=";
47       postPatch = ''
48         substituteInPlace gitsrht-dispatch/main.go \
49           --replace /var/log/gitsrht-dispatch /var/log/sourcehut/gitsrht-dispatch
50       '';
51     }
52     // gqlgen
53   );
55   gitKeys = buildGoModule (
56     {
57       inherit src version;
58       pname = "gitsrht-keys";
59       modRoot = "gitsrht-keys";
60       vendorHash = "sha256-4KwnUi6ILUagMDXzuBG9CRT2N8uyjvRM74TwJqIzicc=";
62       postPatch = ''
63         substituteInPlace gitsrht-keys/main.go \
64           --replace /var/log/gitsrht-keys /var/log/sourcehut/gitsrht-keys
65       '';
66     }
67     // gqlgen
68   );
70   gitShell = buildGoModule (
71     {
72       inherit src version;
73       pname = "gitsrht-shell";
74       modRoot = "gitsrht-shell";
75       vendorHash = "sha256-4KwnUi6ILUagMDXzuBG9CRT2N8uyjvRM74TwJqIzicc=";
77       postPatch = ''
78         substituteInPlace gitsrht-shell/main.go \
79           --replace /var/log/gitsrht-shell /var/log/sourcehut/gitsrht-shell
80       '';
81     }
82     // gqlgen
83   );
85   gitUpdateHook = buildGoModule (
86     {
87       inherit src version;
88       pname = "gitsrht-update-hook";
89       modRoot = "gitsrht-update-hook";
90       vendorHash = "sha256-4KwnUi6ILUagMDXzuBG9CRT2N8uyjvRM74TwJqIzicc=";
92       postPatch = ''
93         substituteInPlace gitsrht-update-hook/main.go \
94           --replace /var/log/gitsrht-update-hook /var/log/sourcehut/gitsrht-update-hook
95       '';
96     }
97     // gqlgen
98   );
100 buildPythonPackage rec {
101   inherit src version;
102   pname = "gitsrht";
103   pyproject = true;
105   disabled = pythonOlder "3.7";
107   postPatch = ''
108     substituteInPlace Makefile \
109       --replace "all: api gitsrht-dispatch gitsrht-keys gitsrht-shell gitsrht-update-hook" ""
110   '';
112   nativeBuildInputs = [
113     pip
114     setuptools
115   ];
117   propagatedBuildInputs = [
118     srht
119     scmsrht
120     pygit2
121     minio
122   ];
124   preBuild = ''
125     export PKGVER=${version}
126     export SRHT_PATH=${srht}/${python.sitePackages}/srht
127   '';
129   postInstall = ''
130     mkdir -p $out/bin
131     ln -s ${gitApi}/bin/api $out/bin/gitsrht-api
132     ln -s ${gitDispatch}/bin/gitsrht-dispatch $out/bin/gitsrht-dispatch
133     ln -s ${gitKeys}/bin/gitsrht-keys $out/bin/gitsrht-keys
134     ln -s ${gitShell}/bin/gitsrht-shell $out/bin/gitsrht-shell
135     ln -s ${gitUpdateHook}/bin/gitsrht-update-hook $out/bin/gitsrht-update-hook
136   '';
138   pythonImportsCheck = [ "gitsrht" ];
140   meta = with lib; {
141     homepage = "https://git.sr.ht/~sircmpwn/git.sr.ht";
142     description = "Git repository hosting service for the sr.ht network";
143     license = licenses.agpl3Only;
144     maintainers = with maintainers; [
145       eadwu
146       christoph-heiss
147     ];
148   };