summary refs log tree commit diff
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/cgit.nix40
-rw-r--r--services/gamja.nix29
-rw-r--r--services/irc/default.nix8
-rw-r--r--services/irc/gamja.nix45
-rw-r--r--services/irc/soju.nix (renamed from services/soju.nix)0
5 files changed, 71 insertions, 51 deletions
diff --git a/services/cgit.nix b/services/cgit.nix
index aeb7115..8b87f80 100644
--- a/services/cgit.nix
+++ b/services/cgit.nix
@@ -7,7 +7,7 @@ let
 
   cgit = pkgs.cgit-pink;
 
-  cgitLocalPort = "3792";
+  cgitLocalPort = 3792;
   cgitDir = "/srv/cgit";
   gitDir = "/srv/git";
 
@@ -35,26 +35,22 @@ let
 
 in
 {
-  virtualisation.oci-containers.containers = {
-    cgit = {
-      # TODO: see above. replace with `imageStream`.
-      imageFile = cgitImage;
-      image = "cgit:${cgit.version}"; # has to match `imageFile`.
-      ports = [ "127.0.0.1:${cgitLocalPort}:80"];
-
-      volumes = [
-        "${cgitDir}/config/cgitrc:/etc/cgitrc"
-        "${cgitDir}/config/lighttpd.conf:/etc/lighttpd/cgit.conf"
-        "${cgitDir}/data:/data"
-        
-        "${gitDir}:/var/www/cgit"
-      ];
-
-      entrypoint = "${pkgs.lighttpd}/bin/lighttpd";
-      cmd = [
-        "-D" # run in foreground
-        "-f" "/etc/lighttpd/cgit.conf"
-      ];
-    };
+  foundation.services.cgit = {
+    image = { imageFile = cgitImage; image = "cgit:${cgit.version}"; };
+    ports = [ [ cgitLocalPort 80 ] ];
+
+    volumes = [
+      [ "${cgitDir}/config/cgitrc" "/etc/cgitrc" ]
+      [ "${cgitDir}/config/lighttpd.conf" "/etc/lighttpd/cgit.conf" ]
+      [ "${cgitDir}/data" "/data" ]
+
+      [ "${gitDir}" "/var/www/cgit" ]
+    ];
+
+    entrypoint = "${pkgs.lighttpd}/bin/lighttpd";
+    cmd = [
+      "-D" # run in foreground
+      "-f" "/etc/lighttpd/cgit.conf"
+    ];
   };
 }
diff --git a/services/gamja.nix b/services/gamja.nix
deleted file mode 100644
index e4cc7ff..0000000
--- a/services/gamja.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ me, pkgs, ... }:
-
-let
-  socketPort = "3030";
-
-  gamjaConfig = {
-     server = {
-       url = "wss://${me.tailscale.domain}/gamja/socket";
-       auth = "mandatory";
-       nick = "mel";
-     };
-  };
-
-  gamja = pkgs.gamja.override { inherit gamjaConfig; };
-
-in
-{
-  # gamja is tailnet interal
-  services.nginx.virtualHosts.renard.locations = {
-    "/gamja" = { return = "301 $scheme://$host$request_uri/"; };
-    "/gamja/" = { alias = "${gamja}/"; };
-
-    "/gamja/socket" = {
-      proxyPass = "http://${me.tailscale.ip}:${socketPort}";
-      proxyWebsockets = true;
-      recommendedProxySettings = true;
-    };
-  };
-}
diff --git a/services/irc/default.nix b/services/irc/default.nix
new file mode 100644
index 0000000..837068a
--- /dev/null
+++ b/services/irc/default.nix
@@ -0,0 +1,8 @@
+{ ... }:
+
+{
+  imports = [
+    ./gamja.nix
+    ./soju.nix
+  ];
+}
diff --git a/services/irc/gamja.nix b/services/irc/gamja.nix
new file mode 100644
index 0000000..779b5b2
--- /dev/null
+++ b/services/irc/gamja.nix
@@ -0,0 +1,45 @@
+{ me, pkgs, ... }:
+
+let
+  socketPort = "3030";
+
+  gamja =
+    let
+      gamjaConfig = {
+        server = {
+          url = "wss://${me.tailscale.domain}/gamja/socket";
+          auth = "mandatory";
+          nick = "mel";
+        };
+      };
+
+      faviconHtml = ''<link rel="shortcut icon" href="/gamja/favicon.png">'';
+      gamja-override = pkgs.gamja.overrideAttrs {
+        pname = "gamja-override";
+
+        fixupPhase = ''
+          sed -i 's:</head>:${faviconHtml}</head>:g' $out/index.html
+          cp ${../../assets/favicon.png} $out/favicon.png
+        '';
+      };
+    in
+    gamja-override.override { inherit gamjaConfig; };
+
+in
+{
+  # gamja is tailnet interal
+  services.nginx.virtualHosts.renard.locations = {
+    "/gamja" = {
+      return = "301 $scheme://$host$request_uri/";
+    };
+    "/gamja/" = {
+      alias = "${gamja}/";
+    };
+
+    "/gamja/socket" = {
+      proxyPass = "http://${me.tailscale.ip}:${socketPort}";
+      proxyWebsockets = true;
+      recommendedProxySettings = true;
+    };
+  };
+}
diff --git a/services/soju.nix b/services/irc/soju.nix
index 75adfaa..75adfaa 100644
--- a/services/soju.nix
+++ b/services/irc/soju.nix