2024-03-05 15:19:01 -05:00
|
|
|
{ config, pkgs, ... }:
|
2024-03-06 23:49:20 -05:00
|
|
|
|
2024-03-05 11:47:33 -05:00
|
|
|
{
|
2024-03-06 23:49:20 -05:00
|
|
|
imports = [
|
|
|
|
../virtualization
|
|
|
|
];
|
|
|
|
|
2024-03-10 23:48:07 -04:00
|
|
|
# services.ddclient.enable = true;
|
|
|
|
# services.ddclient.configFile = "/etc/ddclient/ddclient.conf";
|
|
|
|
|
2024-03-05 15:19:01 -05:00
|
|
|
# Open TCP ports for audiobookshelf, plex-server, and transmission-server.
|
2024-03-10 23:48:07 -04:00
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 51413 13378 32400 9091 ];
|
2024-03-06 22:28:48 -05:00
|
|
|
networking.firewall.allowedUDPPorts = [ 51413 ];
|
|
|
|
|
2024-03-05 15:19:01 -05:00
|
|
|
virtualisation = {
|
|
|
|
oci-containers.containers = {
|
|
|
|
plex-server = {
|
|
|
|
ports = ["0.0.0.0:32400:32400"];
|
|
|
|
image = "plexinc/pms-docker:public";
|
2024-03-07 03:18:57 -05:00
|
|
|
environment = {
|
|
|
|
TZ = "America/New_York";
|
|
|
|
};
|
2024-03-06 22:14:16 -05:00
|
|
|
volumes = [
|
2024-03-07 01:55:47 -05:00
|
|
|
"plex_config:/config"
|
|
|
|
"plex_transcode:/transcode"
|
2024-03-06 22:14:16 -05:00
|
|
|
"/mnt/Media:/Media"
|
|
|
|
];
|
2024-03-05 15:19:01 -05:00
|
|
|
};
|
|
|
|
transmission-server = {
|
2024-03-06 22:28:48 -05:00
|
|
|
ports = ["0.0.0.0:9091:9091" "0.0.0.0:51413:51413"];
|
2024-03-05 15:19:01 -05:00
|
|
|
image = "linuxserver/transmission:latest";
|
2024-03-07 03:18:57 -05:00
|
|
|
environment = {
|
|
|
|
TZ = "America/New_York";
|
|
|
|
};
|
2024-03-06 22:14:16 -05:00
|
|
|
volumes = [
|
2024-03-07 01:55:47 -05:00
|
|
|
"transmission_config:/config"
|
2024-03-07 03:04:26 -05:00
|
|
|
"/mnt/Media/Torrents:/watch"
|
2024-03-06 22:14:16 -05:00
|
|
|
"/mnt/Media:/Media"
|
|
|
|
];
|
2024-03-05 15:19:01 -05:00
|
|
|
};
|
2024-03-10 23:48:07 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
containers.navidrome = {
|
|
|
|
autoStart = true;
|
|
|
|
bindMounts = {
|
|
|
|
"/Music" = { hostPath = "/mnt/Media/Music";
|
|
|
|
isReadOnly = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = { config, pkgs, lib, ... }: {
|
|
|
|
services.navidrome = {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = true;
|
|
|
|
settings = {
|
|
|
|
Address = "0.0.0.0";
|
|
|
|
Port = 4533;
|
|
|
|
MusicFolder = "/Music";
|
|
|
|
DefaultTheme = "Auto";
|
|
|
|
SubsonicArtistParticipations = true;
|
|
|
|
DefaultDownsamplingFormat = "aac";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
system.stateVersion = "24.05";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-03-11 01:04:20 -04:00
|
|
|
containers.audiobookshelf = {
|
|
|
|
autoStart = true;
|
|
|
|
bindMounts = {
|
|
|
|
"/Media" = { hostPath = "/mnt/Media";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = { config, pkgs, lib, ... }: {
|
|
|
|
services.audiobookshelf = {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = true;
|
|
|
|
port = 13378;
|
|
|
|
host = "0.0.0.0";
|
|
|
|
};
|
|
|
|
system.stateVersion = "24.05";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-03-10 23:48:07 -04:00
|
|
|
security.acme = {
|
|
|
|
acceptTerms = true;
|
|
|
|
defaults.email = "alyraffauf@gmail.com";
|
|
|
|
};
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
# other Nginx options
|
|
|
|
virtualHosts."raffauflabs.com" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:12345";
|
|
|
|
proxyWebsockets = true; # needed if you need to use WebSocket
|
|
|
|
extraConfig = ''
|
|
|
|
# required when the target is also TLS server with multiple hosts
|
|
|
|
proxy_ssl_server_name on;
|
|
|
|
# required when the server wants to use HTTP Authentication
|
|
|
|
proxy_pass_header Authorization;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
virtualHosts."podcasts.raffauflabs.com" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:13378";
|
2024-03-11 01:04:20 -04:00
|
|
|
# proxyWebsockets = true; # This breaks audiobookshelf.
|
2024-03-10 23:48:07 -04:00
|
|
|
extraConfig = ''
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_redirect http:// https://;
|
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
virtualHosts."plex.raffauflabs.com" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:32400";
|
|
|
|
proxyWebsockets = true; # needed if you need to use WebSocket
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
virtualHosts."music.raffauflabs.com" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:4533";
|
|
|
|
proxyWebsockets = true; # needed if you need to use WebSocket
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
};
|
2024-03-05 15:19:01 -05:00
|
|
|
};
|
|
|
|
};
|
2024-03-05 11:47:33 -05:00
|
|
|
}
|