138 lines
2.7 KiB
Nix
138 lines
2.7 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.my.services.download-pod;
|
|
|
|
containersDefinition = {
|
|
|
|
jackett = {
|
|
enable = true;
|
|
image = "linuxserver/jackett";
|
|
autoStart = true;
|
|
volumes = [
|
|
"jackett_config:/config"
|
|
"jackett_data:/data"
|
|
];
|
|
};
|
|
|
|
radarr = {
|
|
enable = true;
|
|
image = "linuxserver/radarr";
|
|
autoStart = true;
|
|
volumes = [
|
|
"radarr_config:/config"
|
|
"radarr_data:/data"
|
|
];
|
|
};
|
|
|
|
sabnzbd = {
|
|
enable = false;
|
|
image = "linuxserver/sabnzbd";
|
|
autoStart = true;
|
|
volumes = [
|
|
"sabnzbd_config:/config"
|
|
"sabnzbd_data:/data"
|
|
];
|
|
};
|
|
|
|
sonarr = {
|
|
enable = true;
|
|
image = "linuxserver/sonarr";
|
|
autoStart = true;
|
|
volumes = [
|
|
"sonarr_config:/config"
|
|
"sonarr_data:/data"
|
|
];
|
|
};
|
|
|
|
prowlarr = {
|
|
enable = true;
|
|
image = "linuxserver/prowlarr";
|
|
autoStart = true;
|
|
volumes = [ "prowlarr_config:/config" ];
|
|
};
|
|
};
|
|
|
|
# Pod Definition
|
|
download = {
|
|
name = "download";
|
|
ports = [
|
|
"7878:7878" # : Radarr
|
|
# "8080:8080" # : Sabnzbd
|
|
"8989:8989" # : Sonarr
|
|
"9117:9117" # : Jackett
|
|
"9696:9696" # : Prowlarr
|
|
];
|
|
containers = containersDefinition;
|
|
};
|
|
|
|
in
|
|
{
|
|
options.my.services.download-pod = {
|
|
enable = lib.mkEnableOption "Enable the download searcher stack";
|
|
|
|
proxy = {
|
|
enable = lib.mkEnableOption "Enable proxy for the services";
|
|
|
|
hostName = lib.mkOption {
|
|
default = "example.com";
|
|
type = lib.types.str;
|
|
description = ''
|
|
Top level hostname
|
|
'';
|
|
};
|
|
|
|
serverName = lib.mkOption {
|
|
default = "localhost";
|
|
type = lib.types.str;
|
|
description = ''
|
|
Server name where Caddy is
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
my.virtualisation.podmanPods = {
|
|
inherit download;
|
|
};
|
|
|
|
virtualisation.oci-containers.containers =
|
|
let
|
|
pod = config.helpers.processContainers download;
|
|
in
|
|
pod.containers;
|
|
|
|
services.caddy = lib.mkIf cfg.proxy.enable {
|
|
enable = true;
|
|
enableReload = false;
|
|
virtualHosts = {
|
|
"jackett.${cfg.proxy.hostName}".extraConfig = ''
|
|
reverse_proxy http://${cfg.proxy.serverName}:9117
|
|
'';
|
|
"radarr.${cfg.proxy.hostName}".extraConfig = ''
|
|
reverse_proxy http://${cfg.proxy.serverName}:7878
|
|
'';
|
|
"sabnzbd.${cfg.proxy.hostName}".extraConfig = ''
|
|
reverse_proxy http://${cfg.proxy.serverName}:8080
|
|
'';
|
|
"sonarr.${cfg.proxy.hostName}".extraConfig = ''
|
|
reverse_proxy http://${cfg.proxy.serverName}:8989
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|