summary refs log tree commit diff
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/Rory-desktop/configuration.nix18
-rwxr-xr-xhost/Rory-nginx/configuration.nix17
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/auth.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/event-creator.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/media-repo.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/pusher.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/single/appservice.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/single/background.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/single/user-dir.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix6
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/sync.nix6
15 files changed, 94 insertions, 19 deletions
diff --git a/host/Rory-desktop/configuration.nix b/host/Rory-desktop/configuration.nix
index 3e21734..aa09659 100644
--- a/host/Rory-desktop/configuration.nix
+++ b/host/Rory-desktop/configuration.nix
@@ -24,8 +24,8 @@ args@{
     ./optional/gui/x11.nix
     ./optional/gui/wayland.nix
 
-    ./printing.nix
-    #./ollama.nix
+    #./printing.nix
+#    ./ollama.nix
   ];
 
   boot = {
@@ -230,7 +230,7 @@ args@{
   nixpkgs = {
     config = {
       allowUnfree = true;
-      permittedInsecurePackages = [ 
+      permittedInsecurePackages = [
         "electron-25.9.0"
         "olm-3.2.16"
       ];
@@ -262,5 +262,17 @@ args@{
   virtualisation.libvirtd.enable = true;
   programs.virt-manager.enable = true;
 
+  monitoring = {
+    monitorAll = true;
+    localPrometheus = true;
+    exposePrometheus = true;
+    localGrafana = true;
+    exposeGrafana = true;
+    nginxHost = "monitoring.localhost";
+    nginxSsl = false;
+  };
+  networking.hosts."127.0.0.1" = builtins.attrNames config.services.nginx.virtualHosts;
+  
+
   system.stateVersion = "22.11"; # DO NOT EDIT!
 }
diff --git a/host/Rory-nginx/configuration.nix b/host/Rory-nginx/configuration.nix
index ebcffd3..456e15c 100755
--- a/host/Rory-nginx/configuration.nix
+++ b/host/Rory-nginx/configuration.nix
@@ -1,5 +1,6 @@
 {
   pkgs,
+  config,
   lib,
   grapevine,
   conduit,
@@ -51,6 +52,18 @@
     };
   };
 
+  monitoring = {
+    monitorAll = true;
+    localPrometheus = true;
+    exposePrometheus = true;
+    localGrafana = true;
+    exposeGrafana = true;
+    nginxHost = "monitoring.rory.gay";
+    nginxSsl = true;
+  };
+
+  nixpkgs.config.permittedInsecurePackages = [ "olm-3.2.16" ];
+
   services.irqbalance.enable = true;
 
   environment.memoryAllocator.provider = "jemalloc";
@@ -60,9 +73,7 @@
   #  conduit = grapevine;
   #};
 
-  containers."matrixunittests" = import ./services/containers/matrixunittests/container.nix {
-    inherit pkgs lib grapevine;
-  };
+  containers."matrixunittests" = import ./services/containers/matrixunittests/container.nix { inherit pkgs lib grapevine; };
 
   containers."matrixunittests-conduit" = import ./services/containers/matrixunittests-conduit/container.nix {
     inherit pkgs lib;
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/auth.nix b/host/Rory-nginx/services/matrix/synapse/workers/auth.nix
index 50d52c6..3c8d1e9 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/auth.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/auth.nix
@@ -23,10 +23,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.authWorkers > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix b/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix
index 249084a..60c48a2 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix
@@ -46,10 +46,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.clientReaders > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/event-creator.nix b/host/Rory-nginx/services/matrix/synapse/workers/event-creator.nix
index c841b93..115ce51 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/event-creator.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/event-creator.nix
@@ -19,10 +19,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.eventCreators > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix b/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix
index 83ceec7..effaa69 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix
@@ -12,10 +12,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.federationInboundWorkers > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix b/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix
index 6a16fb6..5b3d4bf 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix
@@ -36,10 +36,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.federationReaders > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix b/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
index cd482f9..07af127 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
@@ -11,10 +11,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.federationSenders > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/media-repo.nix b/host/Rory-nginx/services/matrix/synapse/workers/media-repo.nix
index 62f3e9c..a361390 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/media-repo.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/media-repo.nix
@@ -21,10 +21,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.mediaRepoWorkers > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix b/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix
index 7388824..edf1632 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix
@@ -11,10 +11,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.pushers > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/single/appservice.nix b/host/Rory-nginx/services/matrix/synapse/workers/single/appservice.nix
index 315a322..119fd04 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/single/appservice.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/single/appservice.nix
@@ -11,10 +11,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf cfg.enableAppserviceWorker {
+    monitoring.synapse.workerNames = [ workerName ];
     services.matrix-synapse = {
       settings = {
         instance_map = {
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix b/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix
index b667e19..37fde10 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix
@@ -13,10 +13,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf cfg.enableBackgroundWorker {
+    monitoring.synapse.workerNames = [ workerName ];
     services.matrix-synapse = {
       settings = {
         instance_map = {
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/single/user-dir.nix b/host/Rory-nginx/services/matrix/synapse/workers/single/user-dir.nix
index 89c6aa4..f26f3ec 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/single/user-dir.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/single/user-dir.nix
@@ -16,10 +16,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf cfg.enableUserDirWorker {
+    monitoring.synapse.workerNames = [ workerName ];
     services.matrix-synapse = {
       settings = {
         instance_map = {
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix b/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix
index 35bd4e9..5395aea 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix
@@ -13,10 +13,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.eventStreamWriters > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/sync.nix b/host/Rory-nginx/services/matrix/synapse/workers/sync.nix
index 636f521..6892847 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/sync.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/sync.nix
@@ -17,10 +17,14 @@ let
   };
 in
 let
-  enabledResources = lib.optionals (lib.length workerRoutes.client > 0) [ "client" ] ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ] ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
+  enabledResources =
+    lib.optionals (lib.length workerRoutes.client > 0) [ "client" ]
+    ++ lib.optionals (lib.length workerRoutes.federation > 0) [ "federation" ]
+    ++ lib.optionals (lib.length workerRoutes.media > 0) [ "media" ];
 in
 {
   config = lib.mkIf (cfg.syncWorkers > 0) {
+    monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
     services.matrix-synapse = {
       settings = {
         instance_map = lib.listToAttrs (