diff options
| author | Caroline Larimore <caroline@larimo.re> | 2025-04-14 23:30:30 -0700 |
|---|---|---|
| committer | Caroline Larimore <caroline@larimo.re> | 2025-04-14 23:30:30 -0700 |
| commit | 349ce5d074cb774913d458b27a45ae2053dd935f (patch) | |
| tree | 9910a61911159a7dbfc833ccb4c4028349d3a725 /modules/nixos | |
| parent | f02af8347fefdf4df4812fc33825bf707962fcd9 (diff) | |
copenhagen: status server
Diffstat (limited to 'modules/nixos')
| -rw-r--r-- | modules/nixos/services/web/status/default.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/modules/nixos/services/web/status/default.nix b/modules/nixos/services/web/status/default.nix new file mode 100644 index 0000000..b5a949f --- /dev/null +++ b/modules/nixos/services/web/status/default.nix @@ -0,0 +1,46 @@ +{ options, config, lib, pkgs, namespace, ... }: + +with lib; with lib.${namespace}; let + cfg = config.${namespace}.services.web.status; + impermanence = config.${namespace}.system.impermanence; +in { + options.${namespace}.services.web.status = with types; { + enable = mkEnableOption "status webserver"; + }; + + config = mkIf cfg.enable { + cxl.services.web.enable = true; + + environment.persistence.${impermanence.location} = { + directories = [ + "/srv/web/status" + ]; + }; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + services.nginx = { + enable = true; + virtualHosts = { + "status.cxl.sh" = { + addSSL = true; + enableACME = true; + + locations."/" = { + recommendedProxySettings = true; + proxyPass = "http://127.0.0.1:6969/"; + }; + }; + }; + }; + + systemd.services."cxl.web.status" = { + enable = true; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + ExecStart = "${pkgs.cxl.status}/bin/status 6969 /srv/web/status/auth"; + }; + }; + }; +} |