sourcehut.buildsrht: 0.75.2 -> 0.79.1
This commit is contained in:
parent
dad23bcdd0
commit
43f856ab2c
2 changed files with 28 additions and 10 deletions
|
@ -905,6 +905,11 @@ in
|
|||
inherit configIniOfService;
|
||||
srvsrht = "buildsrht";
|
||||
port = 5002;
|
||||
extraServices.buildsrht-api = {
|
||||
serviceConfig.Restart = "always";
|
||||
serviceConfig.RestartSec = "2s";
|
||||
serviceConfig.ExecStart = "${pkgs.sourcehut.buildsrht}/bin/buildsrht-api -b ${cfg.listenAddress}:${toString (cfg.builds.port + 100)}";
|
||||
};
|
||||
# TODO: a celery worker on the master and worker are apparently needed
|
||||
extraServices.buildsrht-worker = let
|
||||
qemuPackage = pkgs.qemu_kvm;
|
||||
|
@ -928,13 +933,13 @@ in
|
|||
fi
|
||||
'';
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.sourcehut.buildsrht}/bin/builds.sr.ht-worker";
|
||||
ExecStart = "${pkgs.sourcehut.buildsrht}/bin/buildsrht-worker";
|
||||
BindPaths = [ cfg.settings."builds.sr.ht::worker".buildlogs ];
|
||||
LogsDirectory = [ "sourcehut/${serviceName}" ];
|
||||
RuntimeDirectory = [ "sourcehut/${serviceName}/subdir" ];
|
||||
StateDirectory = [ "sourcehut/${serviceName}" ];
|
||||
TimeoutStartSec = "1800s";
|
||||
# builds.sr.ht-worker looks up ../config.ini
|
||||
# buildsrht-worker looks up ../config.ini
|
||||
WorkingDirectory = "-"+"/run/sourcehut/${serviceName}/subdir";
|
||||
};
|
||||
};
|
||||
|
@ -952,12 +957,12 @@ in
|
|||
) cfg.builds.images
|
||||
);
|
||||
image_dir_pre = pkgs.symlinkJoin {
|
||||
name = "builds.sr.ht-worker-images-pre";
|
||||
name = "buildsrht-worker-images-pre";
|
||||
paths = image_dirs;
|
||||
# FIXME: not working, apparently because ubuntu/latest is a broken link
|
||||
# ++ [ "${pkgs.sourcehut.buildsrht}/lib/images" ];
|
||||
};
|
||||
image_dir = pkgs.runCommand "builds.sr.ht-worker-images" { } ''
|
||||
image_dir = pkgs.runCommand "buildsrht-worker-images" { } ''
|
||||
mkdir -p $out/images
|
||||
cp -Lr ${image_dir_pre}/* $out/images
|
||||
'';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ lib
|
||||
, fetchFromSourcehut
|
||||
, buildPythonPackage
|
||||
, buildGoModule
|
||||
, buildPythonPackage
|
||||
, srht
|
||||
, redis
|
||||
, celery
|
||||
|
@ -9,21 +9,29 @@
|
|||
, markdown
|
||||
, ansi2html
|
||||
, python
|
||||
, unzip
|
||||
}:
|
||||
let
|
||||
version = "0.75.2";
|
||||
version = "0.79.1";
|
||||
|
||||
src = fetchFromSourcehut {
|
||||
owner = "~sircmpwn";
|
||||
repo = "builds.sr.ht";
|
||||
rev = version;
|
||||
sha256 = "sha256-SwyxMzmp9baRQ0vceuEn/OpfIv7z7jwq/l67hdOHXjM=";
|
||||
sha256 = "sha256-8fZ6KdD+9+n0uO3jm0AUyG08oCUNFq1K55ZOwLbkpHk=";
|
||||
};
|
||||
|
||||
buildWorker = src: buildGoModule {
|
||||
buildsrht-api = buildGoModule ({
|
||||
inherit src version;
|
||||
pname = "builds-sr-ht-worker";
|
||||
pname = "buildsrht-api";
|
||||
modRoot = "api";
|
||||
vendorSha256 = "sha256-roTwqtg4Y846PNtLdRN/LV3Jd0LVElqjFy3DJcrwoaI=";
|
||||
} // import ./fix-gqlgen-trimpath.nix {inherit unzip;});
|
||||
|
||||
buildsrht-worker = buildGoModule {
|
||||
inherit src version;
|
||||
sourceRoot = "source/worker";
|
||||
pname = "buildsrht-worker";
|
||||
vendorSha256 = "sha256-Pf1M9a43eK4jr6QMi6kRHA8DodXQU0pqq9ua5VC3ER0=";
|
||||
};
|
||||
in
|
||||
|
@ -35,6 +43,10 @@ buildPythonPackage rec {
|
|||
# Revert change breaking Unix socket support for Redis
|
||||
patches/redis-socket/build/0001-Revert-Add-build-submission-and-queue-monitoring.patch
|
||||
];
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace "all: api worker" ""
|
||||
'';
|
||||
|
||||
nativeBuildInputs = srht.nativeBuildInputs;
|
||||
|
||||
|
@ -58,7 +70,8 @@ buildPythonPackage rec {
|
|||
|
||||
cp -r images $out/lib
|
||||
cp contrib/submit_image_build $out/bin/builds.sr.ht
|
||||
cp ${buildWorker "${src}/worker"}/bin/worker $out/bin/builds.sr.ht-worker
|
||||
ln -s ${buildsrht-api}/bin/api $out/bin/buildsrht-api
|
||||
ln -s ${buildsrht-worker}/bin/worker $out/bin/buildsrht-worker
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [ "buildsrht" ];
|
||||
|
|
Loading…
Reference in a new issue