nixpkgs/pkgs/applications/version-management/sourcehut/builds.nix
Christoph Heiss 869781c2f4
sourcehut.buildsrht: 0.83.0 -> 0.86.10
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
2023-11-11 12:39:28 +01:00

83 lines
1.8 KiB
Nix

{ lib
, fetchFromSourcehut
, buildGoModule
, buildPythonPackage
, srht
, redis
, celery
, pyyaml
, markdown
, ansi2html
, lxml
, python
, unzip
}:
let
version = "0.86.10";
src = fetchFromSourcehut {
owner = "~sircmpwn";
repo = "builds.sr.ht";
rev = version;
hash = "sha256-frwJgwJst2/NWd8VR0KbsVwm8JfWuekkY2oIIAdh3Fw=";
};
buildsrht-api = buildGoModule ({
inherit src version;
pname = "buildsrht-api";
modRoot = "api";
vendorHash = "sha256-2khk7j22KON4MsuvFUNKSUpouJtVIOxE0hkh63iaxZ4=";
} // import ./fix-gqlgen-trimpath.nix { inherit unzip; gqlgenVersion = "0.17.29"; });
buildsrht-worker = buildGoModule {
inherit src version;
sourceRoot = "${src.name}/worker";
pname = "buildsrht-worker";
vendorHash = "sha256-obdaeRwMhuiCV2kVwDo1c+rU/hmsbiL1IgAf7AcIpoc=";
};
in
buildPythonPackage rec {
inherit src version;
pname = "buildsrht";
postPatch = ''
substituteInPlace Makefile \
--replace "all: api worker" ""
'';
propagatedBuildInputs = [
srht
redis
celery
pyyaml
markdown
# Unofficial dependencies
ansi2html
lxml
];
preBuild = ''
export PKGVER=${version}
export SRHT_PATH=${srht}/${python.sitePackages}/srht
'';
postInstall = ''
mkdir -p $out/lib
mkdir -p $out/bin/builds.sr.ht
cp -r images $out/lib
cp contrib/submit_image_build $out/bin/builds.sr.ht
ln -s ${buildsrht-api}/bin/api $out/bin/buildsrht-api
ln -s ${buildsrht-worker}/bin/worker $out/bin/buildsrht-worker
'';
pythonImportsCheck = [ "buildsrht" ];
meta = with lib; {
homepage = "https://git.sr.ht/~sircmpwn/builds.sr.ht";
description = "Continuous integration service for the sr.ht network";
license = licenses.agpl3Only;
maintainers = with maintainers; [ eadwu ];
};
}