Commit 46520171f6b2

Vincent Demeester <vincent@sbr.pm>
2025-12-20 22:30:30
feat(aion): prepare audio services migration from rhea
- Add Transmission, audible-sync, and music-playlist-dl to aion - Configure Traefik on rhea to proxy transmission-music to aion - Add DNS entries for transmission-music.sbr.pm and tm.sbr.pm Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 6d42d3d
Changed files (3)
systems/aion/extra.nix
@@ -28,6 +28,8 @@ in
 {
   imports = [
     ../common/services/prometheus-exporters-node.nix
+    ../../modules/audible-sync
+    ../../modules/music-playlist-dl
   ];
 
   users.users.vincent.linger = true;
@@ -40,6 +42,21 @@ in
       endpointPublicKey = "${globals.machines.kerkouane.net.vpn.pubkey}";
     };
 
+    audible-sync = {
+      enable = false; # enable one migration dayrs
+      user = "vincent";
+      outputDir = "/neo/audiobooks";
+      tempDir = "/neo/audiobooks/zz_import"; # Keep AAX files for reuse
+      quality = "best";
+      format = "m4b";
+      schedule = "daily"; # Run daily at 3 AM
+      notification = {
+        enable = true;
+        ntfyUrl = "https://ntfy.sbr.pm";
+        topic = "homelab";
+      };
+    };
+
     rsync-replica = {
       enable = true;
       jobs = {
@@ -66,6 +83,19 @@ in
       };
     };
 
+    music-playlist-dl = {
+      enable = false; # Enable on music migration day
+      user = "vincent";
+      configFile = "/neo/music/music-playlist-dl.yaml";
+      baseDir = "/neo/music/mixes"; # Downloads to /neo/music/mixes/{show}, playlists to /neo/music/playlists
+      schedule = "weekly"; # Run weekly on Sundays at 2 AM
+      notification = {
+        enable = true;
+        ntfyUrl = "https://ntfy.sbr.pm";
+        topic = "homelab";
+      };
+    };
+
     navidrome = {
       enable = true;
       settings = {
@@ -86,6 +116,30 @@ in
         # LastFM.Enabled = true;
       };
     };
+
+    transmission = {
+      enable = false; # Enable on music migration day
+      package = pkgs.transmission_4;
+      openRPCPort = true; # Open firewall for RPC (port 9091)
+      home = "/neo/torrents";
+      settings = {
+        # Override default settings
+        incomplete-dir-enabled = true;
+        rpc-bind-address = "0.0.0.0"; # Bind to all interfaces
+        rpc-host-whitelist = "localhost,tm.sbr.pm,transmission-music.sbr.pm,aion.home,aion.vpn,aion.sbr.pm,192.168.1.51,10.100.0.51";
+        rpc-host-whitelist-enabled = true;
+        rpc-whitelist-enabled = true;
+        rpc-whitelist = "127.0.0.1,192.168.1.*,10.100.0.*"; # Allow local network access
+        rpc-username = "transmission";
+        rpc-password = "transmission";
+        download-queue-enabled = true;
+        download-queue-size = 15;
+        queue-stalled-enabled = true;
+        queue-stalled-minutes = 30;
+        ratio-limit = 0.1;
+        ratio-limit-enabled = true;
+      };
+    };
   };
 
   networking = {
@@ -93,12 +147,16 @@ in
     firewall.allowedTCPPorts = [
       4533 # Navidrome
       9000 # Node exporter
+      9091 # Transmission (music torrents)
     ];
   };
 
   environment.systemPackages = with pkgs; [
     lm_sensors
     gnumake
+    audible-converter
+    audible-cli
+    ffmpeg-full
   ];
 
 }
systems/rhea/extra.nix
@@ -53,9 +53,7 @@ in
     ../common/services/homepage.nix
     ../common/services/prometheus-exporters-node.nix
     ../common/services/prometheus-exporters-postgres.nix
-    ../../modules/audible-sync
     ../../modules/jellyfin-auto-collections
-    ../../modules/music-playlist-dl
   ];
 
   # Age secrets: gandi.env + webdav + jellyfin + generated exportarr secrets
@@ -294,6 +292,10 @@ in
                   "navidrome.sbr.pm"
                   "music.sbr.pm"
                 ];
+                transmission-music = mkRouter "transmission-music" [
+                  "transmission-music.sbr.pm"
+                  "tm.sbr.pm"
+                ];
                 linkwarden = mkRouter "linkwarden" [
                   "linkwarden.sbr.pm"
                   "links.sbr.pm"
@@ -317,6 +319,7 @@ in
                 grafana = mkService "http://${builtins.head globals.machines.sakhalin.net.ips}:3000";
                 linkwarden = mkService "http://${builtins.head globals.machines.sakhalin.net.ips}:3002";
                 navidrome = mkService "http://${builtins.head globals.machines.aion.net.ips}:4533";
+                transmission-music = mkService "http://${builtins.head globals.machines.aion.net.ips}:9091";
               };
             middlewares =
               syncthingMiddlewares
@@ -463,20 +466,6 @@ in
         ];
       };
     };
-    audible-sync = {
-      enable = true;
-      user = "vincent";
-      outputDir = "/neo/audiobooks";
-      tempDir = "/neo/audiobooks/zz_import"; # Keep AAX files for reuse
-      quality = "best";
-      format = "m4b";
-      schedule = "daily"; # Run daily at 3 AM
-      notification = {
-        enable = true;
-        ntfyUrl = "https://ntfy.sbr.pm";
-        topic = "homelab";
-      };
-    };
     jellyfin-auto-collections = {
       enable = true;
       jellyfinUrl = "http://localhost:8096";
@@ -573,18 +562,6 @@ in
         };
       };
     };
-    music-playlist-dl = {
-      enable = true;
-      user = "vincent";
-      configFile = "/neo/music/music-playlist-dl.yaml";
-      baseDir = "/neo/music";
-      schedule = "weekly"; # Run weekly on Sundays at 2 AM
-      notification = {
-        enable = true;
-        ntfyUrl = "https://ntfy.sbr.pm";
-        topic = "homelab";
-      };
-    };
     transmission = serviceDefaults // {
       enable = true;
       package = pkgs.transmission_4;
@@ -721,8 +698,6 @@ in
   environment.systemPackages = with pkgs; [
     lm_sensors
     gnumake
-    audible-converter
-    audible-cli
     ffmpeg-full
   ];
 
globals.nix
@@ -515,6 +515,10 @@ _: {
       host = "rhea";
       aliases = [ "t" ];
     };
+    transmission-music = {
+      host = "rhea";
+      aliases = [ "tm" ];
+    };
     syncthing = {
       host = "rhea";
       aliases = [ "s" ];