summary refs log tree commit diff stats
diff options
context:
space:
mode:
m---------packages0
-rw-r--r--system/linde.nix26
2 files changed, 26 insertions, 0 deletions
diff --git a/packages b/packages
-Subproject e44b42f082aee425459182711649283986ef5e4
+Subproject 1f22eb1d157275d40400c83b57fac4ad65ecb1a
diff --git a/system/linde.nix b/system/linde.nix
index 2ae0b714..3a4b66ec 100644
--- a/system/linde.nix
+++ b/system/linde.nix
@@ -22,6 +22,7 @@ in
   imports =
     [
       <personal/modules/nixos/laminar.nix>
+      <personal/modules/nixos/goatcounter.nix>
       <home-manager/nixos>
       <agenix/modules/age.nix>
       <searchix/nix/modules>
@@ -344,6 +345,17 @@ in
   # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
   system.stateVersion = "23.05"; # Did you read the comment?
 
+  services.goatcounter = {
+    enable = true;
+    listenAddress = "localhost";
+    port = 8082;
+    package = (import <personal> { inherit pkgs; }).goatcounter;
+    settings = {
+      tls = "proxy";
+      websocket = true;
+    };
+  };
+
   services.powerdns =
     let
       inherit (lib.lists) flatten;
@@ -597,6 +609,9 @@ in
       reloadServices = map (x: "kresd@${toString x}") (range 1 config.services.kresd.instances);
       group = "knot-resolver";
     };
+    certs."stats.alanpearce.eu" = {
+      extraDomainNames = [ "*.stats.alanpearce.eu" ];
+    };
   };
   users.groups.acme.members = [
     "caddy"
@@ -729,6 +744,17 @@ in
               reverse_proxy ${srv.settings.bindHTTP}
             '';
           };
+        "stats.alanpearce.eu" =
+          let
+            srv = config.services.goatcounter;
+          in
+          {
+            useACMEHost = "stats.alanpearce.eu";
+            serverAliases = [ "*.stats.alanpearce.eu" ];
+            extraConfig = ''
+              reverse_proxy ${srv.listenAddress}:${toString srv.port}
+            '';
+          };
       };
   };
   systemd.services.caddy.serviceConfig = {