sourcehut: move {hut => code}.sourcephile.fr
[sourcephile-nix.git] / hosts / losurdo / sourcehut.nix
index 77315b1a352c0121af3095df422aa7d724a8ada1..6a51ce68ccc5b8f0dd5aca9ac28d6dfb7be3851d 100644 (file)
@@ -33,8 +33,8 @@ security.gnupg.secrets = lib.genAttrs [
     "sourcehut/webhook-key"
     "sourcehut/oauth-client-secret"
   ] (p: {
-  systemdConfig.before = [ "metasrht.service" ];
-  systemdConfig.wantedBy = [ "metasrht.service" ];
+  systemdConfig.before = [ "metasrht.service" "gitsrht.service" ];
+  systemdConfig.wantedBy = [ "metasrht.service" "gitsrht.service" ];
 });
 services.minio = {
   enable = true;
@@ -46,9 +46,9 @@ services.minio = {
 environment.systemPackages = [ pkgs.minio-client ];
 services.sourcehut = {
   enable = true;
-  listenAddress = domain;
+  listenAddress = "localhost";
   builds = {
-    enable = true;
+    #enable = true;
     enableWorker = true;
     images.nixos.unstable.x86_64 = let
       systemConfig = { pkgs, ... }: {
@@ -154,16 +154,16 @@ services.sourcehut = {
   git.enable = true;
   #hub.enable = true;
   meta.enable = true;
-  man.enable = true;
+  meta.port = 4999;
+  #man.enable = true;
   #pages.enable = true;
-  paste.enable = true;
-  todo.enable = true;
-  lists.enable = true;
+  #paste.enable = true;
+  #todo.enable = true;
+  #lists.enable = true;
 
   postgresql.enable = true;
   postfix.enable = true;
   redis.enable = true;
-  #redis.firstDatabase = 0;
   nginx.enable = true;
   settings = {
     "sr.ht" = {
@@ -215,14 +215,15 @@ services.sourcehut = {
     };
     "meta.sr.ht" = {
       origin = "http://meta.${domain}";
-      api-origin = "http://meta.${domain}:5100";
+      api-origin = "http://localhost:5099";
     };
     "meta.sr.ht::settings" = {
       onboarding-redirect = "http://meta.${domain}";
       registration = true;
-      internal-ipnet = "127.0.0.0/8,192.168.42.0/24";
     };
     "meta.sr.ht::api" = {
+      # This is a temporary workaround
+      #
       internal-ipnet= [ "127.0.0.0/8" "::1/128" "192.168.0.0/16" "10.0.0.0/8"];
     };
     "todo.sr.ht" = {
@@ -295,43 +296,43 @@ systemd.services.postgresql = {
     encoding=UTF8 \
     lc_collate=fr_FR.UTF-8 \
     lc_type=fr_FR.UTF-8 \
-    owner="${sourcehut.git.database}" \
-    pg_createdb "${sourcehut.git.database}" >/dev/null </dev/null
+    owner="${sourcehut.git.postgresql.database}" \
+    pg_createdb "${sourcehut.git.postgresql.database}" >/dev/null </dev/null
 
-    pg_adduser "${sourcehut.git.database}" "${sourcehut.git.database}" >/dev/null
-  */
+    pg_adduser "${sourcehut.git.postgresql.database}" "${sourcehut.git.postgresql.database}" >/dev/null
   postStart = lib.mkAfter ''
-    $PSQL -d "${sourcehut.builds.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.builds.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.builds.user}";
     EOF
-    $PSQL -d "${sourcehut.dispatch.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.dispatch.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.dispatch.user}";
     EOF
-    $PSQL -d "${sourcehut.git.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.git.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.git.user}";
     EOF
-    $PSQL -d "${sourcehut.hub.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.hub.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.hub.user}";
     EOF
-    $PSQL -d "${sourcehut.man.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.man.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.man.user}";
     EOF
-    $PSQL -d "${sourcehut.meta.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.meta.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.meta.user}";
       GRANT USAGE,CREATE ON schema public TO "${users.sshsrht.name}";
     EOF
-    $PSQL -d "${sourcehut.pages.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.pages.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.pages.user}";
     EOF
-    $PSQL -d "${sourcehut.paste.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.paste.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.paste.user}";
     EOF
-    $PSQL -d "${sourcehut.todo.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.todo.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.todo.user}";
     EOF
-    $PSQL -d "${sourcehut.lists.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
+    $PSQL -d "${sourcehut.lists.postgresql.database}" -AqtX --set ON_ERROR_STOP=1 -f - <<EOF
       GRANT USAGE,CREATE ON schema public TO "${sourcehut.lists.user}";
     EOF
   '';
+  */
 };
 }