{ pkgs, config, lib, ... }: let cfg = config.modules.services.sonarr; ids = 2005; in { options.modules.services.sonarr = { enable = lib.mkEnableOption "enables sonarr"; # extra options # mode = lib.mkOption { # type = lib.types.enum [ "server" "client" ]; # default = "client"; # description = "whether syncthing should run as a client (user) or server (system-wide)."; # }; }; config = lib.mkIf cfg.enable { # declare sonarr group users.groups.sonarr = { gid = ids; }; # declare sonarr user users.users.sonarr = { description = "sonarr media server user"; uid = ids; isSystemUser = true; home = "/var/lib/sonarr"; createHome = true; group = "sonarr"; extraGroups = [ "media" ]; }; # enable the sonarr service services.sonarr = { enable = true; openFirewall = true; user = "sonarr"; group = "sonarr"; dataDir = "/var/lib/sonarr"; settings = { server.port = 7105; # default: 8989 }; }; # override umask to make permissions work out systemd.services.sonarr.serviceConfig = { UMask = lib.mkForce "0007"; }; # open firewall #networking.firewall.allowedTCPPorts = [ 7105 ]; # reverse proxy entryo services.nginx.virtualHosts."sonarr.snowbelle.lan" = { enableACME = false; forceSSL = true; sslCertificate = config.sops.secrets."ssl_blakedheld_crt".path; sslCertificateKey = config.sops.secrets."ssl_blakedheld_key".path; locations."/" = { proxyPass = "http://127.0.0.1:7105"; }; }; }; }