diff options
| author | Joe Mou <dev@mou.fo> | 2026-07-15 17:36:23 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-08-11 07:17:05 -0400 |
| commit | 676a0e14413c1b9d16419e03b602688f5cf9852d (patch) | |
| tree | b4fc1be0fe1270dc11080d90612c3f7e3e142d7e /hostnix/elmo | |
| parent | 0c0b48b5da2dcfa6d98d27050c623cd6aa860c5e (diff) | |
BJJ Booker
Diffstat (limited to 'hostnix/elmo')
| -rw-r--r-- | hostnix/elmo/bjj-booker.nix | 49 | ||||
| -rw-r--r-- | hostnix/elmo/configuration.nix | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/hostnix/elmo/bjj-booker.nix b/hostnix/elmo/bjj-booker.nix new file mode 100644 index 0000000..817940a --- /dev/null +++ b/hostnix/elmo/bjj-booker.nix @@ -0,0 +1,49 @@ +{ pkgs, ... }: + +{ + systemd.tmpfiles.rules = [ + "d /opt/bjj-booker 0755 joe users" + ]; + + systemd.sockets.bjj-booker = { + wantedBy = [ "sockets.target" ]; + socketConfig = { + ListenStream = "/run/bjj-booker/socket"; + SocketGroup = "nginx"; + SocketMode = "0660"; + }; + }; + + systemd.services.bjj-booker = { + requires = [ "bjj-booker.socket" ]; + after = [ "bjj-booker.socket" ]; + environment.GYMDESK_EMAIL = "nyc@mou.fo"; + serviceConfig = { + Type = "exec"; + DynamicUser = true; + WorkingDirectory = "/opt/bjj-booker"; + StateDirectory = "bjj-booker"; + LoadCredential = [ "GYMDESK_PASSWORD:/var/secrets/bjj-booker.password" ]; + }; + script = '' + export GYMDESK_PASSWORD=$(< $CREDENTIALS_DIRECTORY/GYMDESK_PASSWORD) + exec ${pkgs.nodejs-slim_24}/bin/node server.js + ''; + }; + + services.nginx.virtualHosts."bjj.mou.fo" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://unix:/run/bjj-booker/socket"; + }; + locations."=/bookings.ics" = { + proxyPass = "http://unix:/run/bjj-booker/socket"; + extraConfig = '' + auth_request off; + ''; + }; + }; + + services.oauth2-proxy.nginx.virtualHosts."bjj.mou.fo" = { }; +} diff --git a/hostnix/elmo/configuration.nix b/hostnix/elmo/configuration.nix index 41a3ae9..a230b31 100644 --- a/hostnix/elmo/configuration.nix +++ b/hostnix/elmo/configuration.nix @@ -4,6 +4,7 @@ imports = [ ./acme.nix ./backup.nix + ./bjj-booker.nix ./cgithub.nix ./dns.nix ./dyndns.nix |
