syntax changes + all the arrs modules

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

View File

@@ -12,8 +12,7 @@ let
};
proxyReverse = port:
proxy {
"/".proxyPass =
"http://${config.my.servers.settings.localhost}:${toString port}/";
"/".proxyPass = "http://${config.my.localhost}:${toString port}/";
};
proxyReverseArr = port:
proxy port // {
@@ -38,8 +37,20 @@ in {
(import ./servers/jellyfin.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/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 {
type = lib.types.str;
default = "127.0.0.1";
@@ -69,6 +80,12 @@ in {
collabora.enable = lib.mkDefault false;
go-vod.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 {
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, ... }:
let
localhost = config.my.servers.settings.localhost;
localhost = config.my.localhost;
port = 8096;
in {
options.my.servers.jellyfin = {
@@ -20,7 +20,7 @@ in {
map $request_uri $h264Level { ~(h264-level=)(.+?)& $2; }
map $request_uri $h264Profile { ~(h264-profile=)(.+?)& $2; }
'';
virtualHosts."flix.${config.my.servers.settings.domain}" = {
virtualHosts."flix.${config.my.domain}" = {
forceSSL = true;
enableACME = 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, ... }:
let port = config.services.microbin.settings.MICROBIN_PORT;
in {
{ lib, config, proxyReverse, ... }: {
options.my.servers.microbin = {
enable = lib.mkEnableOption "enable";
enableCron = lib.mkEnableOption "enable";
@@ -21,8 +19,8 @@ in {
};
nginx = {
enable = true;
virtualHosts."copy.${config.my.servers.settings.domain}" =
proxyReverse port // { };
virtualHosts."copy.${config.my.domain}" =
proxyReverse config.services.microbin.settings.MICROBIN_PORT // { };
};
};
};

View File

@@ -1,6 +1,6 @@
{ lib, config, pkgs, serviceBase, ... }:
let
localhost = config.my.servers.settings.localhost;
localhost = config.my.localhost;
collaboraPort = 9980;
in {
options.my.servers = {
@@ -13,6 +13,8 @@ in {
};
config = lib.mkIf
(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 ];
users.users.nextcloud = {
isSystemUser = true;
@@ -61,7 +63,7 @@ in {
adminpassFile = "${pkgs.writeText "adminpass"
"Overlying-Hatchback-Charting-Encounter-Deface-Gallantly7"}";
dbtype = "pgsql";
dbhost = config.my.servers.settings.postgresSocket;
dbhost = config.my.postgresSocket;
dbtableprefix = "oc_";
dbname = "nextcloud";
};
@@ -124,7 +126,7 @@ in {
{ };
};
};
"collabora.${config.my.servers.settings.domain}" = let
"collabora.${config.my.domain}" = let
localUrl = "http://${localhost}:${toString collaboraPort}";
proxySettings = {
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 // { };
};
};
};
}