nix-config/hosts/servers/hosting-02.nix
Lander Van den Bulcke 491439e7fd
feat: add reverse proxy for wrtagweb
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
2025-10-05 22:49:52 +02:00

143 lines
3.1 KiB
Nix

{
config,
pkgs,
...
}:
{
networking.firewall = {
enable = true;
allowedTCPPorts = [
80
443
];
allowedUDPPorts = [
51820
];
};
services.namespaced-vpn = {
enable = true;
ips = [
"10.64.244.95/32"
"fc00:bbbb:bbbb:bb01::1:f45e/128"
];
publicKey = "KkShcqgwbkX2A9n1hhST6qu+m3ldxdJ2Lx8Eiw6mdXw=";
endpoint = "146.70.117.226:51820";
privateKeyFile = config.sops.secrets.wireguardKey.path;
dns = "10.64.0.1";
};
services.storagebox = {
enable = true;
hostname = "u491729.your-storagebox.de";
hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIICf9svRenC/PLKIL9nk6K/pxQgoiFC41wTNvoIncOxs";
user = "u491729";
sshKeyFile = config.sops.secrets.storageboxKey.path;
passFile = config.sops.secrets.storageboxCryptKey.path;
};
services.slskd = {
enable = true;
domain = "slsk.escapeangle.com";
environmentFile = config.sops.secrets.slskdEnvFile.path;
settings = {
shares.directories = [ "/data/slsk/share" ];
directories = {
downloads = "/data/slsk/downloads";
incomplete = "/data/slsk/incomplete";
};
};
};
systemd.services.slskd.serviceConfig = {
UMask = "0002";
NetworkNamespacePath = "/run/netns/vpn";
};
users.groups.storage = {
name = "storage";
gid = 491729;
members = [
"slskd"
"wrtagweb"
"bandcamp-collection-downloader"
];
};
services.nginx.virtualHosts."sls.escapeangle.com" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://10.10.10.2:${toString config.services.slskd.settings.web.port}";
proxyWebsockets = true;
};
};
services.gonic = {
enable = true;
settings = {
music-path = [ "/data/music" ];
podcast-path = [ "/data/podcast" ];
playlists-path = [ "/data/playlists" ];
};
};
services.nginx.virtualHosts."music.escapeangle.com" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:4747";
proxyWebsockets = true;
};
};
environment.systemPackages = with pkgs; [
unstable.wrtag
];
services.wrtagweb = {
enable = true;
settings.web-api-key = "test";
};
services.nginx.virtualHosts."tag.escapeangle.com" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:7373";
proxyWebsockets = true;
};
};
services.bandcamp-collection-downloader = {
enable = true;
bandcampUser = "lander";
cookiesFile = config.sops.secrets.bandcampcdCookieFile.path;
};
sops = {
defaultSopsFile = ./hosting-02.yaml;
secrets = {
wireguardKey = {
owner = "root";
};
storageboxKey = {
owner = "root";
};
storageboxCryptKey = {
owner = "root";
};
slskdEnvFile = {
owner = config.services.slskd.user;
};
bandcampcdCookieFile = {
owner = "bandcampcd";
};
};
};
security.acme.defaults.email = "landervandenbulcke@gmail.com";
security.acme.acceptTerms = true;
system.stateVersion = "25.05";
}