Refactor local Nginx virtual hosts and update

...local hostnames
This commit is contained in:
Oliver Davies 2024-12-15 23:13:11 +00:00
parent 8e599c2ffd
commit db4cfbc518
7 changed files with 49 additions and 18 deletions

View file

@ -1,13 +1,11 @@
{ config, ... }:
{ {
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts = { virtualHosts = {
"gitea.localhost".locations."/".proxyPass = "http://localhost:2222/";
"immich.localhost".locations."/".proxyPass = "http://localhost:2283/";
"jellyfin.localhost".locations."/".proxyPass = "http://localhost:8096/";
"syncthing.localhost".locations."/".proxyPass = "http://localhost:8384/"; "syncthing.localhost".locations."/".proxyPass = "http://localhost:8384/";
"tubearchivist.localhost".locations."/".proxyPass = "http://localhost:8000/";
}; };
}; };
} }

View file

@ -4,14 +4,14 @@
services.audiobookshelf = { services.audiobookshelf = {
enable = true; enable = true;
host = "audiobookshelf.localhost"; host = "audiobookshelf.davies.home";
port = 4001; port = 4001;
}; };
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts."audiobookshelf.localhost" = { virtualHosts."audiobookshelf.davies.home" = {
locations."/" = { locations."/" = {
proxyPass = "http://localhost:${toString config.services.audiobookshelf.port}/"; proxyPass = "http://localhost:${toString config.services.audiobookshelf.port}/";
proxyWebsockets = true; proxyWebsockets = true;

View file

@ -2,24 +2,35 @@
with lib; with lib;
let
port = 2222;
in
{ {
options.features.homelab.gitea.enable = mkEnableOption "Enable gitea"; options.features.homelab.gitea.enable = mkEnableOption "Enable gitea";
config = mkIf config.features.homelab.gitea.enable { config = mkIf config.features.homelab.gitea.enable {
services.gitea = { services = {
enable = true; gitea = {
group = "media"; enable = true;
stateDir = "/mnt/media/gitea"; group = "media";
stateDir = "/mnt/media/gitea";
settings = { settings = {
server = { server = {
HTTP_PORT = 2222; HTTP_PORT = port;
}; };
service = { service = {
DISABLE_REGISTRATION = true; DISABLE_REGISTRATION = true;
};
}; };
}; };
nginx = {
enable = true;
virtualHosts."gitea.davies.home".locations."/".proxyPass = "http://localhost:${toString port}/";
};
}; };
}; };
} }

View file

@ -18,5 +18,11 @@ with lib;
}; };
environment.systemPackages = [ pkgs.immich-cli ]; environment.systemPackages = [ pkgs.immich-cli ];
services.nginx = {
enable = true;
virtualHosts."immich.davies.home".locations."/".proxyPass = "http://localhost:${toString config.services.immich.port}/";
};
}; };
} }

View file

@ -12,5 +12,11 @@ with lib;
group = "media"; group = "media";
configDir = "/mnt/media/jellyfin"; configDir = "/mnt/media/jellyfin";
}; };
services.nginx = {
enable = true;
virtualHosts."jellyfin.davies.home".locations."/".proxyPass = "http://localhost:8096/";
};
}; };
} }

View file

@ -7,6 +7,9 @@
with lib; with lib;
let
port = 8082;
in
{ {
options.features.homelab.pihole.enable = mkEnableOption "Enable pihole"; options.features.homelab.pihole.enable = mkEnableOption "Enable pihole";
@ -36,7 +39,7 @@ with lib;
"53:53/tcp" "53:53/tcp"
"53:53/udp" "53:53/udp"
"67:67/udp" "67:67/udp"
"8082:80/tcp" "${toString port}:80/tcp"
]; ];
log-driver = "journald"; log-driver = "journald";
@ -94,7 +97,7 @@ with lib;
}; };
services.nginx.virtualHosts."pihole.localhost" = { services.nginx.virtualHosts."pihole.localhost" = {
locations."/".proxyPass = "http://localhost:8082/"; locations."/".proxyPass = "http://localhost:${toString port}/";
}; };
}; };
} }

View file

@ -229,6 +229,7 @@ in
wantedBy = [ "docker-compose-tubearchivist-root.target" ]; wantedBy = [ "docker-compose-tubearchivist-root.target" ];
}; };
systemd.services."docker-volume-tubearchivist_es" = { systemd.services."docker-volume-tubearchivist_es" = {
path = [ pkgs.docker ]; path = [ pkgs.docker ];
@ -284,5 +285,11 @@ in
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
}; };
services.nginx = {
enable = true;
virtualHosts."tubearchivist.davies.home".locations."/".proxyPass = "http://localhost:${toString port}/";
};
}; };
} }