Compare commits

...

8 commits

Author SHA1 Message Date
Vinzenz Schroeter
28d500ac78 fix DERP 2026-01-15 23:19:31 +01:00
Vinzenz Schroeter
8028e1287f headscale: enable DERP 2026-01-15 23:19:31 +01:00
Vinzenz Schroeter
b3166d967f proxy websockets 2026-01-15 23:19:31 +01:00
Vinzenz Schroeter
eea0a072f2 force ssl 2026-01-15 23:19:31 +01:00
Vinzenz Schroeter
81ee5b81c0 fix url 2026-01-15 23:18:30 +01:00
Vinzenz Schroeter
b138f414e0 disable override local 2026-01-15 23:18:30 +01:00
Vinzenz Schroeter
3fd509e11d vpn2: split nginx config 2026-01-15 23:18:30 +01:00
Vinzenz Schroeter
d07b7c159d add headscale 2026-01-15 23:18:30 +01:00
4 changed files with 94 additions and 49 deletions

View file

@ -0,0 +1,43 @@
{ pkgs, ... }:
let
blog-domain-socket = "/run/nginx/blog.sock";
anubis-domain-socket = "/run/anubis/anubis-main/anubis.sock";
anubis-metrics-socket = "/run/anubis/anubis-main/anubis-metrics.sock";
in
{
systemd.services = {
nginx.serviceConfig.SupplementaryGroups = [ "anubis" ];
anubis-main.serviceConfig.SupplementaryGroups = [ "nginx" ];
};
services = {
nginx.virtualHosts = {
"zerforschen.plus" = {
enableACME = true;
forceSSL = true;
locations = {
"/_metrics".proxyPass = "http://unix:" + anubis-metrics-socket + ":/metrics";
"/".proxyPass = "http://unix:" + anubis-domain-socket;
};
};
"blog-in-anubis" = {
root = pkgs.zerforschen-plus-content;
listen = [
{
addr = "unix:" + blog-domain-socket;
}
];
};
};
anubis.instances.main = {
enable = true;
settings = {
BIND = anubis-domain-socket;
TARGET = "unix://" + blog-domain-socket;
METRICS_BIND = anubis-metrics-socket;
};
};
};
}

View file

@ -2,6 +2,8 @@
imports = [ imports = [
./hardware.nix ./hardware.nix
./nginx.nix ./nginx.nix
./headscale.nix
./blog.nix
]; ];
config = { config = {

View file

@ -0,0 +1,43 @@
let
headscale-port = 8668;
in
{
# sudo tailscale up --reset --force-reauth --login-server https://uplink.darkest.space --operator=$USER
services = {
headscale = {
enable = true;
address = "localhost";
port = headscale-port;
settings = {
server_url = "https://uplink.darkest.space/";
dns = {
override_local_dns = false;
base_domain = "high-gravity.space";
};
derp = {
server = {
enabled = true;
verify_clients = true;
stun_listen_addr = "0.0.0.0:3478";
ipv4 = "78.46.242.90";
ipv6 = "2a01:4f8:c013:65dd::1";
};
urls = [ ];
};
};
};
nginx.virtualHosts."uplink.darkest.space" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:${builtins.toString headscale-port}";
proxyWebsockets = true;
};
};
};
# for DERP
networking.firewall.allowedUDPPorts = [ 3478 ];
}

View file

@ -1,62 +1,19 @@
{ pkgs, ... }:
let
blog-domain-socket = "/run/nginx/blog.sock";
anubis-domain-socket = "/run/anubis/anubis-main/anubis.sock";
anubis-metrics-socket = "/run/anubis/anubis-main/anubis-metrics.sock";
in
{ {
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;
defaults.email = "acme@zerforschen.plus"; defaults.email = "acme@zerforschen.plus";
}; };
systemd.services = { services.nginx = {
nginx.serviceConfig.SupplementaryGroups = [ "anubis" ];
anubis-main.serviceConfig.SupplementaryGroups = [ "nginx" ];
};
services = {
nginx = {
enable = true; enable = true;
recommendedProxySettings = true; recommendedProxySettings = true;
recommendedTlsSettings = true; recommendedTlsSettings = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
recommendedOptimisation = true; recommendedOptimisation = true;
virtualHosts = {
"zerforschen.plus" = {
addSSL = true;
enableACME = true;
locations = {
"/_metrics".proxyPass = "http://unix:" + anubis-metrics-socket + ":/metrics";
"/".proxyPass = "http://unix:" + anubis-domain-socket;
};
};
"blog-in-anubis" = {
root = pkgs.zerforschen-plus-content;
listen = [
{
addr = "unix:" + blog-domain-socket;
}
];
};
};
};
anubis.instances.main = {
enable = true;
settings = {
BIND = anubis-domain-socket;
TARGET = "unix://" + blog-domain-socket;
METRICS_BIND = anubis-metrics-socket;
};
};
}; };
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
80 80
443 443
5201
]; ];
} }