forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / applications / version-management / sourcehut / hub.nix
blob4a0d2cda89312677f132ed44b328d2292d77e2e3
1 { lib
2 , fetchFromSourcehut
3 , buildGoModule
4 , buildPythonPackage
5 , python
6 , srht
7 , setuptools
8 , pip
9 , pyyaml
10 , pythonOlder
11 , unzip
14 let
15   version = "0.17.7";
16   gqlgen = import ./fix-gqlgen-trimpath.nix { inherit unzip; gqlgenVersion = "0.17.43"; };
18   src = fetchFromSourcehut {
19     owner = "~sircmpwn";
20     repo = "hub.sr.ht";
21     rev = version;
22     hash = "sha256-IyY7Niy/vZSAXjYZMlxY6uuQ8nH/4yT4+MaRjHtl6G4=";
23   };
25   hubsrht-api = buildGoModule ({
26     inherit src version;
27     pname = "hubsrht-api";
28     modRoot = "api";
29     vendorHash = "sha256-GVN11nEJqIHh8MtKvIXe4zcUwJph9eTSkJ2R+ufD+ic=";
30   } // gqlgen);
32 buildPythonPackage rec {
33   inherit src version;
34   pname = "hubsrht";
35   pyproject = true;
37   disabled = pythonOlder "3.7";
39   postPatch = ''
40     substituteInPlace Makefile --replace "all: api" ""
41   '';
43   nativeBuildInputs = [
44     pip
45     setuptools
46   ];
48   propagatedBuildInputs = [
49     srht
50     pyyaml
51   ];
53   preBuild = ''
54     export PKGVER=${version}
55     export SRHT_PATH=${srht}/${python.sitePackages}/srht
56   '';
58   postInstall = ''
59     ln -s ${hubsrht-api}/bin/api $out/bin/hubsrht-api
60   '';
63   # Module has no tests
64   doCheck = false;
66   pythonImportsCheck = [
67     "hubsrht"
68   ];
70   meta = with lib; {
71     homepage = "https://git.sr.ht/~sircmpwn/hub.sr.ht";
72     description = "Project hub service for the sr.ht network";
73     license = licenses.agpl3Only;
74     maintainers = with maintainers; [ eadwu christoph-heiss ];
75   };