mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
refactor(mediabox): library mounts
This commit is contained in:
parent
228e2cf788
commit
59c61d021e
20 changed files with 416 additions and 101 deletions
38
nixos/access/bazarr.nix
Normal file
38
nixos/access/bazarr.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault mkOptionDefault;
|
||||
cfg = config.services.bazarr;
|
||||
access = config.services.nginx.access.bazarr;
|
||||
proxyPass = mkDefault "https://${access.host}:${toString access.port}";
|
||||
locations = {
|
||||
"/" = {
|
||||
inherit proxyPass;
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.services.nginx.access.bazarr = with lib.types; {
|
||||
host = mkOption {
|
||||
type = str;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = str;
|
||||
default = "bazarr.${config.networking.domain}";
|
||||
};
|
||||
port = mkOption {
|
||||
type = port;
|
||||
};
|
||||
};
|
||||
config.services.nginx = {
|
||||
access.bazarr = mkIf cfg.enable {
|
||||
host = mkOptionDefault "localhost";
|
||||
port = mkOptionDefault cfg.listenPort;
|
||||
};
|
||||
virtualHosts = {
|
||||
${access.domain} = {
|
||||
inherit locations;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
38
nixos/access/jackett.nix
Normal file
38
nixos/access/jackett.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault mkOptionDefault;
|
||||
cfg = config.services.jackett;
|
||||
access = config.services.nginx.access.jackett;
|
||||
proxyPass = mkDefault "https://${access.host}:${toString access.port}";
|
||||
locations = {
|
||||
"/" = {
|
||||
inherit proxyPass;
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.services.nginx.access.jackett = with lib.types; {
|
||||
host = mkOption {
|
||||
type = str;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = str;
|
||||
default = "jackett.${config.networking.domain}";
|
||||
};
|
||||
port = mkOption {
|
||||
type = port;
|
||||
default = cfg.port;
|
||||
};
|
||||
};
|
||||
config.services.nginx = {
|
||||
access.jackett = mkIf cfg.enable {
|
||||
host = mkOptionDefault "localhost";
|
||||
};
|
||||
virtualHosts = {
|
||||
${access.domain} = {
|
||||
inherit locations;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ let
|
|||
"/" = {
|
||||
inherit proxyPass;
|
||||
};
|
||||
"=/ca.pem" = {
|
||||
"=/ca.pem" = mkIf cfg.server.unencrypted.enable {
|
||||
alias = "${cfg.server.unencrypted.package.ca}";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
38
nixos/access/ombi.nix
Normal file
38
nixos/access/ombi.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault mkOptionDefault;
|
||||
cfg = config.services.ombi;
|
||||
access = config.services.nginx.access.ombi;
|
||||
proxyPass = mkDefault "https://${access.host}:${toString access.port}";
|
||||
locations = {
|
||||
"/" = {
|
||||
inherit proxyPass;
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.services.nginx.access.ombi = with lib.types; {
|
||||
host = mkOption {
|
||||
type = str;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = str;
|
||||
default = "ombi.${config.networking.domain}";
|
||||
};
|
||||
port = mkOption {
|
||||
type = port;
|
||||
};
|
||||
};
|
||||
config.services.nginx = {
|
||||
access.ombi = mkIf cfg.enable {
|
||||
host = mkOptionDefault "localhost";
|
||||
port = mkOptionDefault cfg.port;
|
||||
};
|
||||
virtualHosts = {
|
||||
${access.domain} = {
|
||||
inherit locations;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
38
nixos/access/radarr.nix
Normal file
38
nixos/access/radarr.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault mkOptionDefault;
|
||||
cfg = config.services.radarr;
|
||||
access = config.services.nginx.access.radarr;
|
||||
proxyPass = mkDefault "https://${access.host}:${toString access.port}";
|
||||
locations = {
|
||||
"/" = {
|
||||
inherit proxyPass;
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.services.nginx.access.radarr = with lib.types; {
|
||||
host = mkOption {
|
||||
type = str;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = str;
|
||||
default = "radarr.${config.networking.domain}";
|
||||
};
|
||||
port = mkOption {
|
||||
type = port;
|
||||
default = cfg.port;
|
||||
};
|
||||
};
|
||||
config.services.nginx = {
|
||||
access.radarr = mkIf cfg.enable {
|
||||
host = mkOptionDefault "localhost";
|
||||
};
|
||||
virtualHosts = {
|
||||
${access.domain} = {
|
||||
inherit locations;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
38
nixos/access/sonarr.nix
Normal file
38
nixos/access/sonarr.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault mkOptionDefault;
|
||||
cfg = config.services.sonarr;
|
||||
access = config.services.nginx.access.sonarr;
|
||||
proxyPass = mkDefault "https://${access.host}:${toString access.port}";
|
||||
locations = {
|
||||
"/" = {
|
||||
inherit proxyPass;
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.services.nginx.access.sonarr = with lib.types; {
|
||||
host = mkOption {
|
||||
type = str;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = str;
|
||||
default = "sonarr.${config.networking.domain}";
|
||||
};
|
||||
port = mkOption {
|
||||
type = port;
|
||||
default = cfg.port;
|
||||
};
|
||||
};
|
||||
config.services.nginx = {
|
||||
access.sonarr = mkIf cfg.enable {
|
||||
host = mkOptionDefault "localhost";
|
||||
};
|
||||
virtualHosts = {
|
||||
${access.domain} = {
|
||||
inherit locations;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
38
nixos/access/tautulli.nix
Normal file
38
nixos/access/tautulli.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault mkOptionDefault;
|
||||
cfg = config.services.tautulli;
|
||||
access = config.services.nginx.access.tautulli;
|
||||
proxyPass = mkDefault "https://${access.host}:${toString access.port}";
|
||||
locations = {
|
||||
"/" = {
|
||||
inherit proxyPass;
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.services.nginx.access.tautulli = with lib.types; {
|
||||
host = mkOption {
|
||||
type = str;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = str;
|
||||
default = "tautulli.${config.networking.domain}";
|
||||
};
|
||||
port = mkOption {
|
||||
type = port;
|
||||
};
|
||||
};
|
||||
config.services.nginx = {
|
||||
access.tautulli = mkIf cfg.enable {
|
||||
host = mkOptionDefault "localhost";
|
||||
port = mkOptionDefault cfg.port;
|
||||
};
|
||||
virtualHosts = {
|
||||
${access.domain} = {
|
||||
inherit locations;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
{config, ...}: {
|
||||
services = {
|
||||
bazarr = {
|
||||
enable = true;
|
||||
listenPort = 6767;
|
||||
};
|
||||
|
||||
nginx.virtualHosts."bazarr.gensokyo.zone" = {
|
||||
locations."/".proxyPass = "http://localhost:${toString config.services.bazarr.listenPort}";
|
||||
};
|
||||
{
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkDefault;
|
||||
in {
|
||||
services.bazarr = {
|
||||
enable = mkDefault true;
|
||||
listenPort = mkDefault 6767;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ in {
|
|||
declarative = mkDefault true;
|
||||
openFirewall = mkDefault true;
|
||||
web = {
|
||||
enable = true;
|
||||
enable = mkDefault true;
|
||||
};
|
||||
config = {
|
||||
max_upload_speed = 10.0;
|
||||
|
|
@ -27,7 +27,7 @@ in {
|
|||
max_active_limit = 100;
|
||||
max_active_downloading = 75;
|
||||
max_upload_slots_global = 25;
|
||||
max_active_seeding = 1;
|
||||
max_active_seeding = 8;
|
||||
allow_remote = true;
|
||||
daemon_port = 58846;
|
||||
listen_ports = [6881 6889];
|
||||
|
|
@ -37,24 +37,24 @@ in {
|
|||
};
|
||||
|
||||
services.mediatomb.mediaDirectories = let
|
||||
downloadLocation = cfg.config.download_location or (cfg.dataDir + "/Downloads");
|
||||
parent = builtins.dirOf downloadLocation;
|
||||
hasCompletedSubdir = cfg.config.move_completed or false && hasPrefix parent cfg.config.move_completed_path;
|
||||
completedSubdir = removePrefix parent cfg.config.move_completed_path;
|
||||
downloadDir = if hasCompletedSubdir then {
|
||||
inherit (cfg) downloadDir completedDir;
|
||||
parent = builtins.dirOf downloadDir;
|
||||
hasCompletedSubdir = completedDir != null && hasPrefix parent completedDir;
|
||||
completedSubdir = removePrefix parent completedDir;
|
||||
download = if hasCompletedSubdir then {
|
||||
path = parent;
|
||||
subdirectories = [
|
||||
(builtins.baseNameOf downloadLocation)
|
||||
(builtins.baseNameOf downloadDir)
|
||||
completedSubdir
|
||||
];
|
||||
} else {
|
||||
path = downloadLocation;
|
||||
path = downloadDir;
|
||||
};
|
||||
completedDir = {
|
||||
completed = {
|
||||
path = cfg.config.move_completed_path;
|
||||
};
|
||||
in mkIf cfg.enable (mkAfter [
|
||||
downloadDir
|
||||
(mkIf (cfg.config.move_completed or false && !hasCompletedSubdir) completedDir)
|
||||
download
|
||||
(mkIf (completedDir != null && !hasCompletedSubdir) completed)
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
_: {
|
||||
services = {
|
||||
jackett = {
|
||||
enable = true;
|
||||
};
|
||||
nginx.virtualHosts."jackett.gensokyo.zone" = {
|
||||
locations."/".proxyPass = "http://localhost:9117/";
|
||||
};
|
||||
services.jackett = {
|
||||
enable = true;
|
||||
};
|
||||
# Port 9117
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{config, ...}: {
|
||||
services = {
|
||||
ombi = {
|
||||
enable = true;
|
||||
port = 5000;
|
||||
};
|
||||
nginx.virtualHosts."ombi.gensokyo.zone" = {
|
||||
locations."/".proxyPass = "http://localhost:${toString config.services.ombi.port}";
|
||||
};
|
||||
{
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkDefault;
|
||||
in {
|
||||
services.ombi = {
|
||||
enable = mkDefault true;
|
||||
port = mkDefault 5000;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,5 @@
|
|||
_: {
|
||||
services = {
|
||||
radarr = {
|
||||
enable = true;
|
||||
};
|
||||
nginx.virtualHosts."radarr.gensokyo.zone" = {
|
||||
locations."/".proxyPass = "http://localhost:7878";
|
||||
};
|
||||
services.radarr = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Port 7878
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,5 @@
|
|||
_: {
|
||||
services = {
|
||||
sonarr = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
nginx.virtualHosts."sonarr.gensokyo.zone" = {
|
||||
locations."/".proxyPass = "http://localhost:8989";
|
||||
};
|
||||
services.sonarr = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Port 8989
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,8 @@
|
|||
{config, lib, ...}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
cfg = config.services.tautulli;
|
||||
{lib, ...}: let
|
||||
inherit (lib.modules) mkDefault;
|
||||
in {
|
||||
services = {
|
||||
tautulli = {
|
||||
enable = true;
|
||||
port = 8181;
|
||||
};
|
||||
|
||||
nginx.virtualHosts = {
|
||||
"tautulli.${config.networking.domain}" = {
|
||||
locations."/".proxyPass = "http://localhost:${toString cfg.port}";
|
||||
};
|
||||
"tautulli.local.${config.networking.domain}" = mkIf cfg.openFirewall {
|
||||
locations."/".proxyPass = "http://localhost:${toString cfg.port}";
|
||||
};
|
||||
};
|
||||
services.tautulli = {
|
||||
enable = mkDefault true;
|
||||
port = mkDefault 8181;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue