about summary refs log tree commit diff
path: root/modules/radarr.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/radarr.nix')
-rw-r--r--modules/radarr.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/radarr.nix b/modules/radarr.nix
new file mode 100644
index 0000000..9e4e13f
--- /dev/null
+++ b/modules/radarr.nix
@@ -0,0 +1,40 @@
+{
+  config,
+  lib,
+  libNginx,
+  ...
+}:
+with lib;
+let
+  cfg = config.nixfiles.modules.radarr;
+in
+{
+  options.nixfiles.modules.radarr = {
+    enable = mkEnableOption "Radarr";
+
+    domain = mkOption {
+      description = "Domain name sans protocol scheme.";
+      type = with types; str;
+      default = "radarr.${config.networking.domain}";
+    };
+  };
+
+  config = mkIf cfg.enable {
+    ark.directories = [ "/var/lib/radarr" ];
+
+    nixfiles.modules.nginx = {
+      enable = true;
+      upstreams.radarr.servers."127.0.0.1:7878" = { };
+      virtualHosts.${cfg.domain} = {
+        locations."/".proxyPass = "http://radarr";
+        extraConfig = libNginx.config.internalOnly;
+      };
+    };
+
+    services.radarr = {
+      enable = true;
+      user = "rtorrent";
+      group = "rtorrent";
+    };
+  };
+}

Consider giving Nix/NixOS a try! <3