about summary refs log tree commit diff
path: root/modules/services
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-06 12:49:53 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-06 12:49:53 -0700
commitf61e0fe45e4f237828df01ee3bacf4bae78fdcf0 (patch)
tree986fcf274ee755313a35431781acc0a646fe0700 /modules/services
parentrefactor traefik (diff)
downloadworld-f61e0fe45e4f237828df01ee3bacf4bae78fdcf0.tar.gz
refactor transmission and metrics-exporter
Diffstat (limited to 'modules/services')
-rw-r--r--modules/services/default.nix2
-rw-r--r--modules/services/metrics-exporter/default.nix18
-rw-r--r--modules/services/traefik/default.nix2
-rw-r--r--modules/services/transmission/default.nix33
4 files changed, 54 insertions, 1 deletions
diff --git a/modules/services/default.nix b/modules/services/default.nix
index 95c5f21..085e881 100644
--- a/modules/services/default.nix
+++ b/modules/services/default.nix
@@ -5,6 +5,7 @@
     ./fwupd
     ./gitea
     ./grafana
+    ./metrics-exporter
     ./navidrome
     ./prometheus
     ./rclone
@@ -14,6 +15,7 @@
     ./thermald
     ./tlp
     ./traefik
+    ./transmission
     ./unifi
   ];
 }
diff --git a/modules/services/metrics-exporter/default.nix b/modules/services/metrics-exporter/default.nix
new file mode 100644
index 0000000..b461bd2
--- /dev/null
+++ b/modules/services/metrics-exporter/default.nix
@@ -0,0 +1,18 @@
+{ config, pkgs, lib, ... }:
+let cfg = config.my.services.metrics-exporter;
+in {
+  options.my.services.metrics-exporter = with lib; {
+    enable = mkEnableOption "Prometheus metrics exporter";
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.prometheus = {
+      exporters = {
+        node = {
+          enable = true;
+          enabledCollectors = [ "tcpstat" "systemd" "interrupts" ];
+        };
+      };
+    };
+  };
+}
diff --git a/modules/services/traefik/default.nix b/modules/services/traefik/default.nix
index 980faee..d6a8c8c 100644
--- a/modules/services/traefik/default.nix
+++ b/modules/services/traefik/default.nix
@@ -3,7 +3,7 @@
 with lib;
 
 let
-  cfg = config.my.services.navidrome;
+  cfg = config.my.services.traefik;
   domainPublic = "fcuny.net";
   domainPrivate = "fcuny.xyz";
   mkServiceConfig = name: url: domain: certResolver: {
diff --git a/modules/services/transmission/default.nix b/modules/services/transmission/default.nix
new file mode 100644
index 0000000..a1e14ab
--- /dev/null
+++ b/modules/services/transmission/default.nix
@@ -0,0 +1,33 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.services.transmission;
+in {
+  options.my.services.transmission = with lib; {
+    enable = mkEnableOption "transmission torrent server";
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.transmission = {
+      enable = true;
+      group = "nas";
+      performanceNetParameters = true;
+      home = "/data/fast/torrents";
+      settings = {
+        dht-enabled = false;
+        cache-size-mb = 128;
+        peer-port = 52213;
+        peer-port-random-low = 49152;
+        peer-port-random-high = 65535;
+        message-level = 2;
+
+        rpc-enabled = true;
+        rpc-host-whitelist-enabled = false;
+        verify-threads = 4;
+      };
+    };
+
+    networking.firewall = {
+      allowedTCPPorts = [ 52213 ];
+      allowedUDPPorts = [ 52213 ];
+    };
+  };
+}