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";
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
};
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 \
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
};
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
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 @@
- 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