From bed1771ab1f65b55e396d6cfee49f574bec48421 Mon Sep 17 00:00:00 2001 From: Jakub Stachurski Date: Wed, 20 May 2026 16:58:16 +0200 Subject: Add test endpoint --- hosts/omega-relay/default.nix | 11 +++++++++++ modules/default.nix | 1 + modules/test_endpoint.nix | 44 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 modules/test_endpoint.nix diff --git a/hosts/omega-relay/default.nix b/hosts/omega-relay/default.nix index 727b7b0..32ba860 100644 --- a/hosts/omega-relay/default.nix +++ b/hosts/omega-relay/default.nix @@ -43,6 +43,13 @@ isVM = config.addons.virtualisation.isTestVM; in { + test_endpoint = { + enable = true; + domain = if isVM then "omega-relay.local" else "omega-relay.wilkuu.xyz"; + doACME = !isVM; + port = 8080; + }; + stalwart = { enable = true; domain = if isVM then "mail.omega-relay.local" else "mail.wilkuu.xyz"; @@ -127,6 +134,10 @@ }; }; + virtualisation = { + docker.enable = true; + }; + # TODO: Make a nginx module security.acme = lib.mkIf (!config.addons.virtualisation.isTestVM) { acceptTerms = true; diff --git a/modules/default.nix b/modules/default.nix index 26d6ec9..98abe6d 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -14,6 +14,7 @@ ./nh.nix ./motd.nix ./locale.nix + ./test_endpoint.nix ]; nixpkgs.overlays = [ diff --git a/modules/test_endpoint.nix b/modules/test_endpoint.nix new file mode 100644 index 0000000..701bce8 --- /dev/null +++ b/modules/test_endpoint.nix @@ -0,0 +1,44 @@ +{ lib, config, ... }: +let + cfg = config.wilkuu.services.test_endpoint; +in +{ + options.wilkuu.services.test_endpoint = with lib; { + enable = mkOption { + type = types.bool; + default = config.services.nginx.enable; + description = "Whenever to ssl-terminate a small test-endpoint"; + example = true; + }; + port = mkOption { + type = types.port; + default = 6767; + description = "The port to forward traffic to"; + example = 6969; + }; + domain = mkOption { + type = types.str; + default = "test.${config.networking.hostName}.wilkuu.xyz"; + description = "The domain to show"; + example = "test.example.com"; + }; + doACME = mkOption { + type = types.bool; + default = !config.addons.virtualisation.isTestVM; + description = "Whenever to enable SSL or not."; + example = false; + }; + }; + config = lib.mkIf cfg.enable { + services.nginx.virtualHosts.${cfg.domain} = { + addSSL = cfg.doACME; + enableACME = cfg.doACME; + locations."/" = { + proxyPass = "http://localhost:${toString cfg.port}"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; + }; + + }; +} -- cgit v1.3.1