148 lines
3.3 KiB
Nix
148 lines
3.3 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.my.services.download-pod;
|
|
|
|
containers = {
|
|
webserver = {
|
|
enable = true;
|
|
image = "nginx";
|
|
volumes = [
|
|
"aaa:/config"
|
|
"bbb:/data"
|
|
];
|
|
};
|
|
|
|
postgres = {
|
|
enable = false;
|
|
image = "postgres:13";
|
|
};
|
|
};
|
|
|
|
enabledContainers =
|
|
containers:
|
|
lib.mapAttrs (name: container: lib.removeAttrs container [ "enable" ]) (
|
|
lib.filterAttrs (name: container: container.enable) containers
|
|
);
|
|
|
|
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 = {
|
|
mywebapp = {
|
|
name = "mywebapp";
|
|
ports = [
|
|
"9090:80"
|
|
"9443:443"
|
|
];
|
|
containers = enabledContainers containers;
|
|
};
|
|
};
|
|
|
|
virtualisation.oci-containers.containers = enabledContainers containers;
|
|
|
|
# virtualisation.oci-containers.containers = {
|
|
|
|
# jackett = {
|
|
# image = "linuxserver/jackett";
|
|
# autoStart = true;
|
|
# extraOptions = [ "--pod=my-pod" ];
|
|
# volumes = [
|
|
# "jackett_config:/config"
|
|
# "jackett_data:/data"
|
|
# ];
|
|
# };
|
|
|
|
# radarr = {
|
|
# image = "linuxserver/radarr";
|
|
# autoStart = true;
|
|
# extraOptions = [ "--pod=download" ];
|
|
# volumes = [
|
|
# "radarr_config:/config"
|
|
# "radarr_data:/data"
|
|
# ];
|
|
# };
|
|
|
|
# sabnzbd = {
|
|
# image = "linuxserver/sabnzbd";
|
|
# autoStart = true;
|
|
# extraOptions = [ "--pod=download" ];
|
|
# volumes = [
|
|
# "sabnzbd_config:/config"
|
|
# "sabnzbd_data:/data"
|
|
# ];
|
|
# };
|
|
|
|
# sonarr = {
|
|
# image = "linuxserver/sonarr";
|
|
# autoStart = true;
|
|
# extraOptions = [ "--pod=download" ];
|
|
# volumes = [
|
|
# "sonarr_config:/config"
|
|
# "sonarr_data:/data"
|
|
# ];
|
|
# };
|
|
|
|
# prowlarr = {
|
|
# image = "linuxserver/prowlarr";
|
|
# autoStart = true;
|
|
# extraOptions = [ "--pod=download" ];
|
|
# volumes = [ "prowlarr_config:/config" ];
|
|
# };
|
|
|
|
# };
|
|
|
|
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
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|