jenkins: 2.479.3 -> 2.492.1
[NixPkgs.git] / pkgs / applications / version-management / sourcehut / hg.nix
blob23e99349d24d6e851a0e88214e0c9d48d4837eac
2   lib,
3   fetchFromSourcehut,
4   buildGoModule,
5   buildPythonPackage,
6   srht,
7   python-hglib,
8   scmsrht,
9   unidiff,
10   python,
11   unzip,
12   pip,
13   pythonOlder,
14   setuptools,
17 let
18   version = "0.33.0";
19   gqlgen = import ./fix-gqlgen-trimpath.nix {
20     inherit unzip;
21     gqlgenVersion = "0.17.45";
22   };
24   pyproject = true;
26   disabled = pythonOlder "3.7";
28   src = fetchFromSourcehut {
29     owner = "~sircmpwn";
30     repo = "hg.sr.ht";
31     rev = version;
32     hash = "sha256-+BYeE+8dXY/MLLYyBBLD+eKqmrPiKyyCGIZLkCPzNYM=";
33     vc = "hg";
34   };
36   hgsrht-api = buildGoModule (
37     {
38       inherit src version;
39       pname = "hgsrht-api";
40       modRoot = "api";
41       vendorHash = "sha256-K+KMhcvkG/qeQTnlHS4xhLCcvBQNNp2DcScJPm8Dbic=";
42     }
43     // gqlgen
44   );
46   hgsrht-keys = buildGoModule {
47     inherit src version;
48     pname = "hgsrht-keys";
49     modRoot = "hgsrht-keys";
50     vendorHash = "sha256-7ti8xCjSrxsslF7/1X/GY4FDl+69hPL4UwCDfjxmJLU=";
52     postPatch = ''
53       substituteInPlace hgsrht-keys/main.go \
54         --replace /var/log/hgsrht-keys /var/log/sourcehut/hgsrht-keys
55     '';
56   };
58 buildPythonPackage rec {
59   inherit src version;
60   pname = "hgsrht";
62   postPatch = ''
63     substituteInPlace Makefile \
64       --replace "all: api hgsrht-keys" ""
66     substituteInPlace hgsrht-shell \
67       --replace /var/log/hgsrht-shell /var/log/sourcehut/hgsrht-shell
68   '';
70   nativeBuildInputs = [
71     pip
72     setuptools
73   ];
75   propagatedBuildInputs = [
76     python-hglib
77     scmsrht
78     srht
79     unidiff
80   ];
82   preBuild = ''
83     export PKGVER=${version}
84     export SRHT_PATH=${srht}/${python.sitePackages}/srht
85   '';
87   postInstall = ''
88     ln -s ${hgsrht-api}/bin/api $out/bin/hgsrht-api
89     ln -s ${hgsrht-keys}/bin/hgsrht-keys $out/bin/hgsrht-keys
90   '';
92   pythonImportsCheck = [ "hgsrht" ];
94   meta = with lib; {
95     homepage = "https://git.sr.ht/~sircmpwn/hg.sr.ht";
96     description = "Mercurial repository hosting service for the sr.ht network";
97     license = licenses.agpl3Only;
98     maintainers = with maintainers; [
99       eadwu
100       christoph-heiss
101     ];
102   };