diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-06-06 14:31:16 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-06-06 14:31:24 +0530 |
| commit | 7bcd223aa4537f054eb140c3b5461ee7a4d03b19 (patch) | |
| tree | e79840736e54be4a62f9bad001d8c29875e97c5e | |
| parent | 08d9f9f645080a2b03c608eea6a08fcac8674256 (diff) | |
| download | nixos-config-7bcd223aa4537f054eb140c3b5461ee7a4d03b19.tar.gz nixos-config-7bcd223aa4537f054eb140c3b5461ee7a4d03b19.zip | |
Add sonarr/radarr/prowlarr + add service routing
| -rw-r--r-- | configuration.nix | 11 | ||||
| -rw-r--r-- | modules/jackett.nix | 8 | ||||
| -rw-r--r-- | modules/service-router.module.nix | 34 | ||||
| -rw-r--r-- | modules/torrent.nix | 55 |
4 files changed, 93 insertions, 15 deletions
diff --git a/configuration.nix b/configuration.nix index 561266a..c53af09 100644 --- a/configuration.nix +++ b/configuration.nix @@ -10,11 +10,11 @@ ./hardware/thinkpad-e14/default.nix ./packages.nix ./overlays-system.nix + ./modules/service-router.module.nix ./modules/login.nix ./modules/torrent.nix ./modules/work.nix ./modules/keyboard/default.nix - ./modules/jackett.nix ./modules/thunderbird/default.nix ./modules/clamav.nix ./modules/lockscreen.nix @@ -26,6 +26,8 @@ allowBroken = false; }; + services.service-router.enable = true; + services.udisks2.enable = true; programs.dconf.enable = true; @@ -57,10 +59,9 @@ nameservers = [ "100.100.100.100" "8.8.8.8" "1.1.1.1" ]; search = [ "resolve.construction" ]; networkmanager.enable = true; - extraHosts = '' - 127.0.0.1 phenax.local - 127.0.0.1 field.shape-e2e.com - ''; + hosts = { + "127.0.0.1" = ["phenax.local" "field.shape-e2e.com"]; + }; }; services.atd.enable = true; diff --git a/modules/jackett.nix b/modules/jackett.nix deleted file mode 100644 index 132bc33..0000000 --- a/modules/jackett.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - services.jackett = { - enable = false; - port = 9117; - openFirewall = false; - }; -} diff --git a/modules/service-router.module.nix b/modules/service-router.module.nix new file mode 100644 index 0000000..e1da4fb --- /dev/null +++ b/modules/service-router.module.nix @@ -0,0 +1,34 @@ +{ config, lib, ... }: +with lib; +let + cfg = config.services.service-router; + hostname = name: "${name}.local"; +in { + options.services.service-router = { + enable = mkEnableOption "enable router"; + routes = mkOption { + type = types.attrsOf (types.submodule { options = { + port = mkOption { type = types.int; }; + host = mkOption { type = types.str; default = "127.0.0.1"; }; + protocol = mkOption { type = types.str; default = "http"; }; + }; }); + default = {}; + }; + }; + + config = lib.mkIf cfg.enable { + services.nginx = { + enable = true; + virtualHosts = lib.mapAttrs' (name: val: { + name = hostname name; + value = { + locations."/" = { + proxyPass = "${val.protocol}://${val.host}:${toString val.port}"; + }; + }; + }) cfg.routes; + }; + + networking.hosts."127.0.0.1" = lib.mapAttrsToList (name: _: hostname name) cfg.routes; + }; +} diff --git a/modules/torrent.nix b/modules/torrent.nix index 9e74aca..884d646 100644 --- a/modules/torrent.nix +++ b/modules/torrent.nix @@ -1,12 +1,33 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: let downloadsDir = "/home/imsohexy/Downloads/dl"; - incompleteDownloadsDir = "/home/imsohexy/Downloads/dl/incomplete"; + incompleteDownloadsDir = "${downloadsDir}/incomplete"; watchTorrentFilesOn = "/home/imsohexy/Downloads/qute"; + + radarrPort = 7878; + sonarrPort = 8989; + prowlarrPort = 9696; + + group = "multimedia"; in { + systemd.tmpfiles.rules = [ + "d ${downloadsDir} 0770 - ${group} - -" + ]; + users.groups."${group}" = { }; + users.users.imsohexy.extraGroups = [ group ]; + + environment.systemPackages = with pkgs; [ managarr ]; + + services.service-router.routes = { + sonarr.port = sonarrPort; + radarr.port = radarrPort; + prowlarr.port = prowlarrPort; + }; + services.transmission = { enable = true; + group = group; settings = { "download-dir" = downloadsDir; "download-queue-enabled" = true; @@ -32,4 +53,34 @@ in "watch-dir-enabled" = false; }; }; + + services.sonarr = { + enable = true; + # openFirewall = true; + user = "imsohexy"; + group = group; + settings = { + server.port = sonarrPort; + auth.enabled = false; + }; + }; + + services.radarr = { + enable = true; + # openFirewall = true; + user = "imsohexy"; + group = group; + settings = { + server.port = radarrPort; + auth.enabled = false; + }; + }; + + services.prowlarr = { + enable = true; + # openFirewall = true; + settings = { + server.port = prowlarrPort; + }; + }; } |
