about summary refs log tree commit diff
path: root/nix/hosts/corrino/www/cs.emile.space.nix
diff options
context:
space:
mode:
authorEmile <git@emile.space>2024-09-13 15:04:06 +0200
committerEmile <git@emile.space>2024-09-13 15:04:06 +0200
commit35d6c2c70824cf77ef2216889cc9730b622f5ac1 (patch)
tree2435a97f87409deb57c279fb41534e0d10c901ca /nix/hosts/corrino/www/cs.emile.space.nix
parent902c97cf9aa16c5bb4a45b28f182e4d6033156e7 (diff)
big push
Diffstat (limited to 'nix/hosts/corrino/www/cs.emile.space.nix')
-rw-r--r--nix/hosts/corrino/www/cs.emile.space.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/nix/hosts/corrino/www/cs.emile.space.nix b/nix/hosts/corrino/www/cs.emile.space.nix
new file mode 100644
index 0000000..4f1b91e
--- /dev/null
+++ b/nix/hosts/corrino/www/cs.emile.space.nix
@@ -0,0 +1,54 @@
+{ config, lib, ... }:
+
+let
+
+	# get's all repos configured in cgit and converts them into some JSON that is used by hound
+	repos = builtins.toJSON
+		(lib.mergeAttrsList
+			(map
+				(x: {"${x.name}" = { url = "file://${x.path}"; }; })
+				(lib.mapAttrsToList
+					(name: value: value // { name = "${name}"; })
+					config.services.cgit.main.repos)));
+in {
+	services.nginx.virtualHosts."cs.emile.space" = {
+		forceSSL = true;
+		enableACME = true;
+		locations = {
+			"/" = {
+        proxyPass = "http://${config.services.hound.listen}";
+			};
+		};
+	};
+
+	# add hound user to git group so the local repos can be read
+  # users.users.hound.extraGroups = [ "git" ];
+
+	users.groups."git".members = [ "hound" ];
+
+	# The `.gitignore` of the user `hound` should contain the following:
+	#
+	# [safe]
+  #       directory = /var/lib/git/repositories/*
+  #       directory = /var/lib/git/repositories/faila.git
+  #       directory = /var/lib/git/repositories/faila2.git
+
+	services.hound = {
+		enable = true;
+
+		config = ''
+			{
+			  "dbpath": "/var/lib/hound/data",
+			  "max-concurrent-indexers" : 6,
+		    "vcs-config" : {
+	        "git" : {
+            "detect-ref" : true
+	        }
+		    },
+			  "repos" : ${repos}
+			}
+		'';
+
+		listen = "127.0.0.1:${toString config.emile.ports.hound}";
+	};
+}