From e6ed60548397627bf10f561f9438201dbba0a36e Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 21 Apr 2024 02:15:42 +0300 Subject: 2024-04-21 --- modules/sonarr.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 modules/sonarr.nix (limited to 'modules/sonarr.nix') diff --git a/modules/sonarr.nix b/modules/sonarr.nix new file mode 100644 index 0000000..b11dda0 --- /dev/null +++ b/modules/sonarr.nix @@ -0,0 +1,40 @@ +{ + config, + lib, + libNginx, + ... +}: +with lib; +let + cfg = config.nixfiles.modules.sonarr; +in +{ + options.nixfiles.modules.sonarr = { + enable = mkEnableOption "Sonarr"; + + domain = mkOption { + description = "Domain name sans protocol scheme."; + type = with types; str; + default = "sonarr.${config.networking.domain}"; + }; + }; + + config = mkIf cfg.enable { + ark.directories = [ "/var/lib/sonarr" ]; + + nixfiles.modules.nginx = { + enable = true; + upstreams.sonarr.servers."127.0.0.1:8989" = { }; + virtualHosts.${cfg.domain} = { + locations."/".proxyPass = "http://sonarr"; + extraConfig = libNginx.config.internalOnly; + }; + }; + + services.sonarr = { + enable = true; + user = "rtorrent"; + group = "rtorrent"; + }; + }; +} -- cgit v1.2.3