diff options
Diffstat (limited to 'hostnix/elmo/cal.nix')
| -rw-r--r-- | hostnix/elmo/cal.nix | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/hostnix/elmo/cal.nix b/hostnix/elmo/cal.nix new file mode 100644 index 0000000..64950a4 --- /dev/null +++ b/hostnix/elmo/cal.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: + +{ + systemd.tmpfiles.rules = [ + "d /opt/cal 0755 joe users" + ]; + + # TODO socket activation + systemd.services.cal = { + # Deno writes its module cache under $HOME, which DynamicUser does not give + # us; point it at /var/cache/cal instead. + # TODO node + environment.DENO_DIR = "/var/cache/cal"; + serviceConfig = { + Type = "exec"; + DynamicUser = true; + WorkingDirectory = "/opt/cal"; + StateDirectory = "cal"; + CacheDirectory = "cal"; + ExecStart = "${pkgs.deno}/bin/deno run --allow-net --allow-read --allow-write=/opt/cal/web/events,/opt/cal/web/_site web/server.ts"; + }; + }; + + # TODO allocate domain? + services.nginx.virtualHosts."cal.elmo.mou.fo" = { + useACMEHost = "elmo.mou.fo"; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:8000"; + }; + }; +} |
