172 lines
3.2 KiB
Nix
172 lines
3.2 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"
|
|
];
|
|
};
|
|
|
|
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
|
|
podDefinition = {
|
|
name = "download";
|
|
ports = [
|
|
"7878:7878" # : Radarr
|
|
"8989:8989" # : Sonarr
|
|
"9117:9117" # : Jackett
|
|
"9696:9696" # : Prowlarr
|
|
];
|
|
containers = containersDefinition;
|
|
};
|
|
|
|
in
|
|
{
|
|
options.my.services.download-pod = {
|
|
|
|
programs = {
|
|
enable = lib.mkEnableOption "Enable the download search 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.mkMerge [
|
|
|
|
# Services definition
|
|
(lib.mkIf cfg.programs.enable {
|
|
|
|
services = {
|
|
|
|
# Indexer
|
|
prowlarr = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
};
|
|
|
|
# Movies
|
|
radarr = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
};
|
|
|
|
# TV Shows
|
|
sonarr = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
};
|
|
|
|
# Music
|
|
lidarr = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
};
|
|
|
|
# E-books
|
|
readarr = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
};
|
|
|
|
};
|
|
|
|
# my.virtualisation.podmanPods = {
|
|
# inherit podDefinition;
|
|
# };
|
|
|
|
# virtualisation.oci-containers.containers =
|
|
# let
|
|
# pod = config.helpers.processContainers podDefinition;
|
|
# in
|
|
# pod.containers;
|
|
|
|
})
|
|
|
|
# Caddy for reverse proxy
|
|
(lib.mkIf cfg.proxy.enable {
|
|
|
|
services.caddy = {
|
|
enable = true;
|
|
package = pkgs.caddy-custom;
|
|
# {env.CLOUDFLARE_KEY}
|
|
extraConfig = ''
|
|
(cloudflare) {
|
|
tls {
|
|
dns cloudflare {env.CLOUDFLARE_KEY}
|
|
}
|
|
}
|
|
'';
|
|
virtualHosts."prowlarr.tegola.pro".extraConfig = ''
|
|
reverse_proxy http://arr.internal:9696
|
|
import cloudflare
|
|
'';
|
|
virtualHosts."radarr.tegola.pro".extraConfig = ''
|
|
reverse_proxy http://arr.internal:7878
|
|
import cloudflare
|
|
'';
|
|
};
|
|
})
|
|
];
|
|
}
|