syntax changes + all the arrs modules

This commit is contained in:
Danilo Reyes 2024-06-14 18:10:56 -06:00
parent c80e097ba0
commit add0490415
13 changed files with 162 additions and 80 deletions

View File

@ -118,42 +118,6 @@
PASSWORD = "RkawpqMc8lR56QyU7JSfiLhG"; PASSWORD = "RkawpqMc8lR56QyU7JSfiLhG";
}; };
}; };
flame-nsfw = {
autoStart = true;
image = "pawelmalak/flame";
ports = [ "5007:5005" ];
volumes = [ "/var/lib/docker-configs/flame-nsfw:/app/data" ];
environment = {
TZ = "America/Mexico_City";
PUID = "1000";
PGID = "100";
PASSWORD = "RkawpqMc8lR56QyU7JSfiLhG";
};
};
# lidarr = {
# autoStart = true;
# image = "lscr.io/linuxserver/lidarr:latest";
# ports = [ "8686:8686" ];
# environment = {
# TZ = "America/Mexico_City";
# PUID = "1000";
# PGID = "100";
# };
# volumes = [
# "/mnt/pool/multimedia:/data"
# "/mnt/pool/multimedia/media/Music:/music"
# "/mnt/pool/multimedia/media/MusicVideos:/music-videos"
# "/var/lib/docker-configs/lidarr/files:/config"
# "/var/lib/docker-configs/lidarr/custom-services.d:/custom-services.d"
# "/var/lib/docker-configs/lidarr/custom-cont-init.d:/custom-cont-init.d"
# ];
# labels = {
# "flame.type" = "application";
# "flame.name" = "Lidarr";
# "flame.url" = "music.servidos.lat";
# "flame.icon" = "music";
# };
# };
mealie = { mealie = {
autoStart = true; autoStart = true;
image = "ghcr.io/mealie-recipes/mealie:v1.4.0"; image = "ghcr.io/mealie-recipes/mealie:v1.4.0";
@ -183,6 +147,18 @@
"flame.icon" = "fridge"; "flame.icon" = "fridge";
}; };
}; };
flame-nsfw = {
autoStart = true;
image = "pawelmalak/flame";
ports = [ "5007:5005" ];
volumes = [ "/var/lib/docker-configs/flame-nsfw:/app/data" ];
environment = {
TZ = "America/Mexico_City";
PUID = "1000";
PGID = "100";
PASSWORD = "RkawpqMc8lR56QyU7JSfiLhG";
};
};
}; };
}; };
}; };

View File

@ -10,18 +10,13 @@ let
shioriPort = 4368; shioriPort = 4368;
flamePort = 5005; flamePort = 5005;
secretFlamePort = 5007; secretFlamePort = 5007;
# lidarrPort = 8686;
qbitPort = 9091; qbitPort = 9091;
# prowlarrPort = 9696;
# radarrPort = 7878;
# sonarrPort = 8989;
mealiePort = 9925; mealiePort = 9925;
ryotPort = 8765; ryotPort = 8765;
scrobblePort = 9078; scrobblePort = 9078;
malojaPort = 42010; malojaPort = 42010;
darkwirePort = 3001; darkwirePort = 3001;
metatubePort = 8881; metatubePort = 8881;
# bazarrPort = config.services.bazarr.listenPort;
# kavitaPort = config.services.kavita.port; # kavitaPort = config.services.kavita.port;
vaultPort = config.services.vaultwarden.config.ROCKET_PORT; vaultPort = config.services.vaultwarden.config.ROCKET_PORT;
audiobookPort = config.services.audiobookshelf.port; audiobookPort = config.services.audiobookshelf.port;
@ -57,13 +52,8 @@ in {
# ''; # '';
# }; # };
in { in {
# "movies.${domain}" = proxyArr radarrPort // { };
# "indexer.${domain}" = proxyArr prowlarrPort // { };
# "music.${domain}" = proxyArr lidarrPort // { };
# "library.${domain}" = proxy kavitaPort // { }; # "library.${domain}" = proxy kavitaPort // { };
"start.${domain}" = proxy flamePort // { }; "start.${domain}" = proxy flamePort // { };
# "subs.${domain}" = proxy bazarrPort // { };
# "series.${domain}" = proxy sonarrPort // { };
"vault.${domain}" = proxy vaultPort // { }; "vault.${domain}" = proxy vaultPort // { };
"mealie.${domain}" = proxy mealiePort // { }; "mealie.${domain}" = proxy mealiePort // { };
"tracker.${domain}" = proxy ryotPort // { }; "tracker.${domain}" = proxy ryotPort // { };

View File

@ -3,11 +3,7 @@ let
localhost = "127.0.0.1"; localhost = "127.0.0.1";
postgresSocket = "/run/postgresql"; postgresSocket = "/run/postgresql";
in { in {
disabledModules = [ "services/web-apps/shiori.nix" ]; imports = [ ./nginx.nix ];
imports = [ ./nginx.nix ../../pkgs/shiori/shiori-service.nix ];
nixpkgs.config = {
permittedInsecurePackages = [ "nodejs-14.21.3" "openssl-1.1.1v" ];
};
environment.systemPackages = [ environment.systemPackages = [
# Upgrades postgres # Upgrades postgres
(let (let
@ -41,11 +37,10 @@ in {
]; ];
users.users = let base = { isSystemUser = true; }; users.users = let base = { isSystemUser = true; };
in { in {
# # prowlarr = base // { group = "piracy"; }; # kavita = base // {
# # kavita = base // { # group = "kavita";
# # group = "kavita"; # extraGroups = [ "piracy" ];
# # extraGroups = [ "piracy" ]; # };
# # };
}; };
services = let services = let
base = { base = {
@ -53,23 +48,12 @@ in {
group = "piracy"; group = "piracy";
}; };
in { in {
# sonarr = base // { package = pkgs.sonarr; };
# radarr = base // { package = pkgs.radarr; };
# bazarr = base // { };
# prowlarr.enable = true;
# jira.enable = true; # jira.enable = true;
# adguardhome = { # adguardhome = {
# enable = true; # enable = true;
# mutableSettings = true; # mutableSettings = true;
# openFirewall = true; # openFirewall = true;
# }; # };
shiori = {
enable = true;
port = 4368;
package = pkgs.callPackage ../../pkgs/shiori/shiori.nix { };
httpSecretKey = "password";
databaseUrl = "postgres:///shiori?host=${postgresSocket}";
};
# audiobookshelf = { # audiobookshelf = {
# enable = true; # enable = true;
# group = "piracy"; # group = "piracy";

View File

@ -12,8 +12,7 @@ let
}; };
proxyReverse = port: proxyReverse = port:
proxy { proxy {
"/".proxyPass = "/".proxyPass = "http://${config.my.localhost}:${toString port}/";
"http://${config.my.servers.settings.localhost}:${toString port}/";
}; };
proxyReverseArr = port: proxyReverseArr = port:
proxy port // { proxy port // {
@ -38,8 +37,20 @@ in {
(import ./servers/jellyfin.nix { inherit lib config pkgs serviceBase; }) (import ./servers/jellyfin.nix { inherit lib config pkgs serviceBase; })
(import ./servers/nextcloud.nix { inherit lib config pkgs serviceBase; }) (import ./servers/nextcloud.nix { inherit lib config pkgs serviceBase; })
(import ./servers/microbin.nix { inherit lib config proxyReverse; }) (import ./servers/microbin.nix { inherit lib config proxyReverse; })
(import ./servers/shiori.nix { inherit lib config pkgs proxyReverse; })
(import ./servers/sonarr.nix {
inherit lib config serviceBase proxyReverse;
})
(import ./servers/bazarr.nix {
inherit lib config serviceBase proxyReverse;
})
(import ./servers/radarr.nix {
inherit lib config serviceBase proxyReverseArr;
})
(import ./servers/prowlarr.nix { inherit lib config proxyReverseArr; })
(import ./servers/lidarr.nix { inherit lib config proxyReverseArr; })
]; ];
options.my.servers.settings = { options.my = {
localhost = lib.mkOption { localhost = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "127.0.0.1"; default = "127.0.0.1";
@ -69,6 +80,12 @@ in {
collabora.enable = lib.mkDefault false; collabora.enable = lib.mkDefault false;
go-vod.enable = lib.mkDefault false; go-vod.enable = lib.mkDefault false;
microbin.enable = lib.mkDefault false; microbin.enable = lib.mkDefault false;
shiori.enable = lib.mkDefault false;
sonarr.enable = lib.mkDefault false;
bazarr.enable = lib.mkDefault false;
radarr.enable = lib.mkDefault false;
lidarr.enable = lib.mkDefault false;
prowlarr.enable = lib.mkDefault false;
}; };
virtualisation.docker = lib.mkIf enableDocker { virtualisation.docker = lib.mkIf enableDocker {
enable = true; enable = true;

View File

@ -0,0 +1,13 @@
{ lib, config, serviceBase, proxyReverse, ... }: {
options.my.servers.bazarr.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.servers.bazarr.enable {
services = {
bazarr = serviceBase // { };
nginx = {
enable = true;
virtualHosts."subs.${config.my.domain}" =
proxyReverse config.services.bazarr.listenPort // { };
};
};
};
}

View File

@ -1,6 +1,6 @@
{ lib, config, pkgs, serviceBase, ... }: { lib, config, pkgs, serviceBase, ... }:
let let
localhost = config.my.servers.settings.localhost; localhost = config.my.localhost;
port = 8096; port = 8096;
in { in {
options.my.servers.jellyfin = { options.my.servers.jellyfin = {
@ -20,7 +20,7 @@ in {
map $request_uri $h264Level { ~(h264-level=)(.+?)& $2; } map $request_uri $h264Level { ~(h264-level=)(.+?)& $2; }
map $request_uri $h264Profile { ~(h264-profile=)(.+?)& $2; } map $request_uri $h264Profile { ~(h264-profile=)(.+?)& $2; }
''; '';
virtualHosts."flix.${config.my.servers.settings.domain}" = { virtualHosts."flix.${config.my.domain}" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
http2 = true; http2 = true;

View File

@ -0,0 +1,39 @@
{ lib, config, proxyReverseArr, ... }: {
options.my.servers.lidarr.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.servers.lidarr.enable {
virtualisation.oci-containers = {
backend = "docker";
containers.lidarr = {
autoStart = true;
image = "lscr.io/linuxserver/lidarr:latest";
ports = [ "8686:8686" ];
environment = {
TZ = "America/Mexico_City";
PUID = "1000";
PGID = "100";
};
volumes = [
"/mnt/pool/multimedia:/data"
"/mnt/pool/multimedia/media/Music:/music"
"/mnt/pool/multimedia/media/MusicVideos:/music-videos"
"/var/lib/docker-configs/lidarr/files:/config"
"/var/lib/docker-configs/lidarr/custom-services.d:/custom-services.d"
"/var/lib/docker-configs/lidarr/custom-cont-init.d:/custom-cont-init.d"
];
labels = {
"flame.type" = "application";
"flame.name" = "Lidarr";
"flame.url" = "music.servidos.lat";
"flame.icon" = "music";
};
};
};
services = {
lidarr.enable = true;
nginx = {
enable = true;
virtualHosts."music.${config.my.domain}" = proxyReverseArr 8686 // { };
};
};
};
}

View File

@ -1,6 +1,4 @@
{ lib, config, proxyReverse, ... }: { lib, config, proxyReverse, ... }: {
let port = config.services.microbin.settings.MICROBIN_PORT;
in {
options.my.servers.microbin = { options.my.servers.microbin = {
enable = lib.mkEnableOption "enable"; enable = lib.mkEnableOption "enable";
enableCron = lib.mkEnableOption "enable"; enableCron = lib.mkEnableOption "enable";
@ -21,8 +19,8 @@ in {
}; };
nginx = { nginx = {
enable = true; enable = true;
virtualHosts."copy.${config.my.servers.settings.domain}" = virtualHosts."copy.${config.my.domain}" =
proxyReverse port // { }; proxyReverse config.services.microbin.settings.MICROBIN_PORT // { };
}; };
}; };
}; };

View File

@ -1,6 +1,6 @@
{ lib, config, pkgs, serviceBase, ... }: { lib, config, pkgs, serviceBase, ... }:
let let
localhost = config.my.servers.settings.localhost; localhost = config.my.localhost;
collaboraPort = 9980; collaboraPort = 9980;
in { in {
options.my.servers = { options.my.servers = {
@ -13,6 +13,8 @@ in {
}; };
config = lib.mkIf config = lib.mkIf
(config.my.servers.nextcloud.enable && config.my.servers.postgres.enable) { (config.my.servers.nextcloud.enable && config.my.servers.postgres.enable) {
nixpkgs.config.permittedInsecurePackages =
[ "nodejs-14.21.3" "openssl-1.1.1v" ];
environment.systemPackages = with pkgs; [ mediainfo dlib ]; environment.systemPackages = with pkgs; [ mediainfo dlib ];
users.users.nextcloud = { users.users.nextcloud = {
isSystemUser = true; isSystemUser = true;
@ -61,7 +63,7 @@ in {
adminpassFile = "${pkgs.writeText "adminpass" adminpassFile = "${pkgs.writeText "adminpass"
"Overlying-Hatchback-Charting-Encounter-Deface-Gallantly7"}"; "Overlying-Hatchback-Charting-Encounter-Deface-Gallantly7"}";
dbtype = "pgsql"; dbtype = "pgsql";
dbhost = config.my.servers.settings.postgresSocket; dbhost = config.my.postgresSocket;
dbtableprefix = "oc_"; dbtableprefix = "oc_";
dbname = "nextcloud"; dbname = "nextcloud";
}; };
@ -124,7 +126,7 @@ in {
{ }; { };
}; };
}; };
"collabora.${config.my.servers.settings.domain}" = let "collabora.${config.my.domain}" = let
localUrl = "http://${localhost}:${toString collaboraPort}"; localUrl = "http://${localhost}:${toString collaboraPort}";
proxySettings = { proxySettings = {
proxyPass = localUrl; proxyPass = localUrl;

View File

@ -0,0 +1,17 @@
{ lib, config, proxyReverseArr, ... }: {
options.my.servers.prowlarr.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.servers.prowlarr.enable {
users.users.prowlarr = {
group = "piracy";
isSystemUser = true;
};
services = {
prowlarr.enable = true;
nginx = {
enable = true;
virtualHosts."indexer.${config.my.domain}" = proxyReverseArr 9696
// { };
};
};
};
}

View File

@ -0,0 +1,12 @@
{ lib, config, serviceBase, proxyReverseArr, ... }: {
options.my.servers.radarr.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.servers.radarr.enable {
services = {
radarr = serviceBase // { };
nginx = {
enable = true;
virtualHosts."movies.${config.my.domain}" = proxyReverseArr 7878 // { };
};
};
};
}

View File

@ -0,0 +1,22 @@
{ lib, config, pkgs, proxyReverse, ... }: {
disabledModules = [ "services/web-apps/shiori.nix" ];
imports = [ ../../pkgs/shiori/shiori-service.nix ];
options.my.servers.shiori.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.servers.shiori.enable {
services = {
shiori = {
enable = true;
port = 4368;
package = pkgs.callPackage ../../pkgs/shiori/shiori.nix { };
httpSecretKey = "password";
databaseUrl =
"postgres:///shiori?host=${config.my.postgresSocket}";
};
nginx = {
enable = true;
virtualHosts."copy.${config.my.domain}" =
proxyReverse config.my.servers.shiori.port // { };
};
};
};
}

View File

@ -0,0 +1,12 @@
{ lib, config, serviceBase, proxyReverse, ... }: {
options.my.servers.sonarr.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.servers.sonarr.enable {
services = {
sonarr = serviceBase // { };
nginx = {
enable = true;
virtualHosts."series.${config.my.domain}" = proxyReverse 8989 // { };
};
};
};
}