summaryrefslogtreecommitdiff
path: root/config/services/mesh
diff options
context:
space:
mode:
authorquentin@aristote.fr <quentin@aristote.fr>2026-11-29 17:24:18 +0100
committerquentin@aristote.fr <quentin@aristote.fr>2026-11-29 17:42:35 +0100
commitce831333a24011d0692f6871047fe74eab9fab8c (patch)
tree9bb971e2afe0a4b22c73274e8b8e8d05d014401d /config/services/mesh
downloadhermaphroditos-ce831333a24011d0692f6871047fe74eab9fab8c.tar.gz
hermaphroditos-ce831333a24011d0692f6871047fe74eab9fab8c.tar.bz2
hermaphroditos-ce831333a24011d0692f6871047fe74eab9fab8c.tar.xz
initial commit
Diffstat (limited to 'config/services/mesh')
-rw-r--r--config/services/mesh/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/config/services/mesh/default.nix b/config/services/mesh/default.nix
new file mode 100644
index 0000000..0d596cc
--- /dev/null
+++ b/config/services/mesh/default.nix
@@ -0,0 +1,48 @@
+{
+ config,
+ lib,
+ ...
+}:
+let
+ cfg = config.services.headscale;
+ url = "mesh.${config.networking.domain}";
+in
+{
+ networking.firewall.allowedUDPPorts = [ 3478 ];
+
+ services.headscale = {
+ enable = true;
+ port = 8001;
+ settings = {
+ server_url = "https://${url}:443";
+ derps = {
+ server = {
+ enabled = true;
+ stun_listen_addr = "0.0.0.0:3478";
+ };
+ urls = [ ];
+ };
+ dns = {
+ base_domain = "aristote.mesh";
+ override_local_dns = false;
+ };
+ };
+ };
+
+ systemd.services.headscale.personal.monitor = true;
+
+ services.nginx.virtualHosts.mesh = lib.mkIf cfg.enable {
+ serverName = "${url}";
+ forceSSL = true;
+ enableACME = true;
+ locations."/" = {
+ proxyPass = "http://${cfg.address}:${toString cfg.port}";
+ proxyWebsockets = true;
+ extraConfig = ''
+ proxy_redirect http:// https://;
+ proxy_buffering off;
+ add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
+ '';
+ };
+ };
+}