{ 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"; }; }; }