losurdo: sourcehut: sync config with module changes
authorJulien Moutinho <julm@sourcephile.fr>
Sat, 7 Aug 2021 04:26:39 +0000 (06:26 +0200)
committerJulien Moutinho <julm@sourcephile.fr>
Fri, 13 Aug 2021 08:42:20 +0000 (10:42 +0200)
hosts/losurdo/postfix.nix
hosts/losurdo/sourcehut.nix
nixpkgs/patches/sourcehut.diff

index 14d4f075d21b66780d34e6be48ad23e2a9a5eb90..cc81d84e36470fabb9d2062b34e567ca90be0480 100644 (file)
@@ -239,8 +239,6 @@ services.postfix = {
     fallback_transport = "";
   };
   transport = ''
-    lists.sourcephile.wg lmtp:unix:/tmp/lists.sr.ht-lmtp.sock
-    todo.sourcephile.wg  lmtp:unix:/tmp/todo.sr.ht-lmtp.sock
     sourcephile.wg local:losurdo
   '';
   virtualMapType = "hash";
index 9e0915a5c39b168f61d26dabb08cd7b0520ea24b..5979576662a3cd0f1af173626305f412ec48fe33 100644 (file)
@@ -3,41 +3,53 @@ let
   inherit (config.services) sourcehut;
   inherit (config.users) groups;
   domain = "sourcephile.wg";
+  sourcehut-services = [
+    "builds"
+    "dispatch"
+    "git"
+    "hg"
+    "hub"
+    "lists"
+    "meta"
+    "man"
+    "paste"
+    "todo"
+  ];
 in
 {
 #boot.isContainer = true;
 #networking.firewall.allowedTCPPorts = [ 80 ];
 networking.hosts = {
-  "192.168.42.2" = [domain] ++ map (d: "${d}.${domain}") sourcehut.services;
+  "192.168.42.2" = [domain] ++ map (d: "${d}.${domain}") sourcehut-services;
 };
 networking.nftables.ruleset = ''
   add rule inet filter fw2net meta skuid ${sourcehut.meta.user} tcp dport 25 counter accept comment "SMTP"
 '';
 services.sourcehut = {
   enable = true;
-  originBase = domain;
-  address = domain;
-  services = [
-    #"builds"
-    "dispatch"
-    "git"
-    "hub"
-    "lists"
-    "man"
-    "meta"
-    "todo"
-    "paste"
-  ];
+  listenAddress = domain;
   /*
   builds = {
     enableWorker = true;
   };
   */
+  dispatch.enable = true;
   git = {
+    enable = true;
   };
+  hub.enable = true;
   meta = {
+    enable = true;
     port = 5000;
   };
+  postgresql.enable = true;
+  postfix.enable = true;
+  redis.enable = true;
+  redis.firstDatabase = 1;
+  nginx.enable = true;
+  man.enable = true;
+  paste.enable = true;
+  todo.enable = false;
   settings = {
     "sr.ht" = {
       environment = "production";
@@ -45,9 +57,9 @@ services.sourcehut = {
       origin = "http://${domain}";
       owner-email = "julm+srht@sourcephile.fr";
       owner-name = "Sourcephile";
-      site-blurb = "forge";
+      site-blurb = "software forge";
       site-info = "http://${domain}";
-      site-name = "Sourcephile's sourcehut";
+      site-name = "Sourcephile";
       # nix shell nixpkgs#sourcehut.coresrht -c srht-keygen network
       network-key = "OeXzQ6A8Vcgt5QJkXScuxeXCtfdKzKev99BRNb3_CWQ=";
       # nix shell nixpkgs#sourcehut.coresrht -c srht-keygen service
@@ -148,7 +160,6 @@ services.nginx.virtualHosts = {
 };
 systemd.services.nginx.serviceConfig.LogsDirectory =
   lib.mkForce ["/var/log/nginx/${domain}/meta"];
-users.groups."postgres".members = map (n: sourcehut.${n}.user) sourcehut.services;
 systemd.services.postgresql = {
   /*
     connection_limit=64 \
index a5ea27c4af3b9ca732fde57fd50946614a7a9184..f0a9dc95e5fbcae8d679953e2cad6f6448856181 100644 (file)
@@ -46,6 +46,26 @@ index d359d524eb2..2d9a18bb233 100644
      fetchSubmodules = true;
    };
  
+diff --git a/pkgs/applications/version-management/sourcehut/default.nix b/pkgs/applications/version-management/sourcehut/default.nix
+index 401a1437b7d..00810f208cc 100644
+--- a/pkgs/applications/version-management/sourcehut/default.nix
++++ b/pkgs/applications/version-management/sourcehut/default.nix
+@@ -22,6 +22,7 @@ let
+       listssrht = self.callPackage ./lists.nix { };
+       mansrht = self.callPackage ./man.nix { };
+       metasrht = self.callPackage ./meta.nix { };
++      pagessrht = self.callPackage ./pages.nix { };
+       pastesrht = self.callPackage ./paste.nix { };
+       todosrht = self.callPackage ./todo.nix { };
+@@ -40,6 +41,7 @@ with python.pkgs; recurseIntoAttrs {
+   listssrht = toPythonApplication listssrht;
+   mansrht = toPythonApplication mansrht;
+   metasrht = toPythonApplication metasrht;
++  pagessrht = pagessrht;
+   pastesrht = toPythonApplication pastesrht;
+   todosrht = toPythonApplication todosrht;
+ }
 diff --git a/pkgs/applications/version-management/sourcehut/dispatch.nix b/pkgs/applications/version-management/sourcehut/dispatch.nix
 index 637c6f9c1df..af2ea1e9a4f 100644
 --- a/pkgs/applications/version-management/sourcehut/dispatch.nix
@@ -192,6 +212,74 @@ index a285d484ed2..87122a03cab 100644
    };
  
  in
+diff --git a/pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch b/pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch
+new file mode 100644
+index 00000000000..9b3f6fbc6fb
+--- /dev/null
++++ b/pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch
+@@ -0,0 +1,27 @@
++From 3df160ad289b25574322f587095d00d6641f057c Mon Sep 17 00:00:00 2001
++From: Juan Picca <juan.picca@jumapico.uy>
++Date: Wed, 21 Jul 2021 08:26:56 -0300
++Subject: [PATCH] Fix syntax error in schema.sql
++
++---
++ schema.sql | 4 ++--
++ 1 file changed, 2 insertions(+), 2 deletions(-)
++
++diff --git a/schema.sql b/schema.sql
++index 168377f..2e473ea 100644
++--- a/schema.sql
+++++ b/schema.sql
++@@ -28,8 +28,8 @@ CREATE TABLE sites (
++      user_id integer NOT NULL references "user"(id),
++      domain varchar NOT NULL,
++      protocol protocol NOT NULL,
++-     version varchar NOT NULL
++-     UNIQUE (domain, protocol),
+++     version varchar NOT NULL,
+++     UNIQUE (domain, protocol)
++ );
++ 
++ COMMIT;
++-- 
++2.32.0
++
+diff --git a/pkgs/applications/version-management/sourcehut/pages.nix b/pkgs/applications/version-management/sourcehut/pages.nix
+new file mode 100644
+index 00000000000..c4f0a217927
+--- /dev/null
++++ b/pkgs/applications/version-management/sourcehut/pages.nix
+@@ -0,0 +1,29 @@
++{ lib
++, fetchFromSourcehut
++, buildGoModule
++}:
++let
++  version = "0.4.8";
++
++  src = fetchFromSourcehut {
++    owner = "~sircmpwn";
++    repo = "pages.sr.ht";
++    rev = version;
++    sha256 = "sha256-z9w8v5e6LY6VUEczltyD55KEUUH7Gw1vUO00KPmT+D8=";
++  };
++
++in
++buildGoModule {
++  inherit src version;
++  pname = "pagessrht";
++  vendorSha256 = "sha256-xOd9i+PNlLxZrw/+z/C9V+AbOLEociW2YHY+x1K+mJI=";
++  patches = [
++    ./pages-fix-syntax-error-in-schema.sql.patch
++  ];
++  meta = with lib; {
++    homepage = "https://git.sr.ht/~sircmpwn/pages.sr.ht";
++    description = "Web hosting service for the sr.ht network";
++    license = licenses.agpl3;
++    maintainers = with maintainers; [ eadwu ];
++  };
++}
 diff --git a/pkgs/applications/version-management/sourcehut/paste.nix b/pkgs/applications/version-management/sourcehut/paste.nix
 index 0d8c9135493..71a95bb10b0 100644
 --- a/pkgs/applications/version-management/sourcehut/paste.nix
@@ -253,7 +341,7 @@ index 85e1f5637b6..8aa4730b1cb 100644
  
    nativeBuildInputs = srht.nativeBuildInputs;
 diff --git a/pkgs/applications/version-management/sourcehut/update.sh b/pkgs/applications/version-management/sourcehut/update.sh
-index 156d4cc35e4..8cb4f708006 100755
+index 156d4cc35e4..36040c6d14f 100755
 --- a/pkgs/applications/version-management/sourcehut/update.sh
 +++ b/pkgs/applications/version-management/sourcehut/update.sh
 @@ -1,8 +1,11 @@
@@ -332,7 +420,7 @@ index 156d4cc35e4..8cb4f708006 100755
 -    update_version "$service"
 -  done
 +  services=( "srht" "buildsrht" "dispatchsrht" "gitsrht" "hgsrht" "hubsrht" "listssrht" "mansrht"
-+             "metasrht" "pastesrht" "todosrht" "scmsrht" )
++             "metasrht" "pagessrht" "pastesrht" "todosrht" "scmsrht" )
  fi
 +
 +for service in "${services[@]}"; do