1
0
Fork 0

mediaserver: add sonarr

This commit is contained in:
Daniel Kempkens 2023-04-16 00:11:15 +02:00
parent 144527067e
commit cbd56c0c46
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
2 changed files with 54 additions and 0 deletions

View file

@ -22,6 +22,7 @@ in
../nixos/wireguard-netns.nix ../nixos/wireguard-netns.nix
../nixos/prowlarr.nix ../nixos/prowlarr.nix
../nixos/sabnzbd.nix ../nixos/sabnzbd.nix
../nixos/sonarr.nix
]; ];
system.stateVersion = "22.11"; system.stateVersion = "22.11";

53
system/nixos/sonarr.nix Normal file
View file

@ -0,0 +1,53 @@
{ pkgs, lib, ... }:
{
services.sonarr = {
enable = true;
user = "media_user";
group = "media_group";
openFirewall = false;
};
systemd.services.sonarr = {
bindsTo = [ "wg.service" ];
after = lib.mkForce [ "wg.service" ];
serviceConfig = {
NetworkNamespacePath = "/var/run/netns/wg";
};
};
systemd.services.socat-sonarr = {
description = "socat exposes sonarr";
bindsTo = [ "wg.service" ];
requires = [ "sonarr.service" ];
after = [ "wg.service" ];
serviceConfig = {
Type = "simple";
RuntimeDirectory = "socat-sonarr";
DynamicUser = true;
UMask = "000";
NetworkNamespacePath = "/var/run/netns/wg";
ExecStart = "${pkgs.socat}/bin/socat -d -d UNIX-LISTEN:/run/socat-sonarr/sonarr.sock,unlink-early,fork TCP4:127.0.0.1:8989";
Restart = "on-failure";
};
};
services.nginx.virtualHosts."sonarr.internal.kempkens.network" = {
quic = true;
http3 = true;
onlySSL = true;
useACMEHost = "internal.kempkens.network";
extraConfig = ''
client_max_body_size 32m;
'';
locations."/" = {
recommendedProxySettings = true;
proxyPass = "http://unix:/run/socat-sonarr/sonarr.sock:/";
};
};
}