about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJulien Moutinho <julm+nixpkgs@sourcephile.fr>2022-05-06 00:05:06 +0200
committertomberek <tomberek@users.noreply.github.com>2022-06-08 19:46:04 -0400
commit59d8439966cf6ca5f2967e56a52fb98ae85d4e60 (patch)
treee09653e1a57e6ff9ea5e96154b3f8a5046db911b
parent0f1e37bc5ba35519a272a846bc32fdd34a447c6b (diff)
sourcehut.listssrht: 0.51.7 -> 0.51.9
-rw-r--r--nixos/modules/services/misc/sourcehut/default.nix5
-rw-r--r--pkgs/applications/version-management/sourcehut/lists.nix21
2 files changed, 24 insertions, 2 deletions
diff --git a/nixos/modules/services/misc/sourcehut/default.nix b/nixos/modules/services/misc/sourcehut/default.nix
index 45b8943ed8e7d..6a9b3c8de8384 100644
--- a/nixos/modules/services/misc/sourcehut/default.nix
+++ b/nixos/modules/services/misc/sourcehut/default.nix
@@ -1199,6 +1199,11 @@ in
       inherit configIniOfService;
       port = 5006;
       webhooks = true;
+      extraServices.listssrht-api = {
+        serviceConfig.Restart = "always";
+        serviceConfig.RestartSec = "2s";
+        serviceConfig.ExecStart = "${pkgs.sourcehut.listssrht}/bin/listssrht-api -b ${cfg.listenAddress}:${toString (cfg.lists.port + 100)}";
+      };
       # Receive the mail from Postfix and enqueue them into Redis and PostgreSQL
       extraServices.listssrht-lmtp = {
         wants = [ "postfix.service" ];
diff --git a/pkgs/applications/version-management/sourcehut/lists.nix b/pkgs/applications/version-management/sourcehut/lists.nix
index 3ba6375a91380..d264553112156 100644
--- a/pkgs/applications/version-management/sourcehut/lists.nix
+++ b/pkgs/applications/version-management/sourcehut/lists.nix
@@ -1,5 +1,6 @@
 { lib
 , fetchFromSourcehut
+, buildGoModule
 , buildPythonPackage
 , srht
 , asyncpg
@@ -8,23 +9,35 @@
 , emailthreads
 , redis
 , python
+, unzip
 }:
 
 buildPythonPackage rec {
   pname = "listssrht";
-  version = "0.51.7";
+  version = "0.51.9";
 
   src = fetchFromSourcehut {
     owner = "~sircmpwn";
     repo = "lists.sr.ht";
     rev = version;
-    sha256 = "sha256-oNY5A98oVoL2JKO0fU/8YVl8u7ywmHb/RHD8A6z9yIM=";
+    sha256 = "sha256-6iyt0XXAHvyp4bA+VW9uA9YP9wq2Rf/WYVZxylSRf7k=";
   };
 
+  listssrht-api = buildGoModule ({
+    inherit src version;
+    pname = "listssrht-api";
+    modRoot = "api";
+    vendorSha256 = "sha256-xnmMkRSokbhWD+kz0XQ9AinYdm6/50FRBISURPvlzD0=";
+  } // import ./fix-gqlgen-trimpath.nix {inherit unzip;});
+
   patches = [
     # Revert change breaking Unix socket support for Redis
     patches/redis-socket/lists/0001-Revert-Add-webhook-queue-monitoring.patch
   ];
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace "all: api" ""
+  '';
 
   nativeBuildInputs = srht.nativeBuildInputs;
 
@@ -42,6 +55,10 @@ buildPythonPackage rec {
     export SRHT_PATH=${srht}/${python.sitePackages}/srht
   '';
 
+  postInstall = ''
+    ln -s ${listssrht-api}/bin/api $out/bin/listssrht-api
+  '';
+
   pythonImportsCheck = [ "listssrht" ];
 
   meta = with lib; {