summaryrefslogtreecommitdiff
path: root/hostnix/elmo/cal.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hostnix/elmo/cal.nix')
-rw-r--r--hostnix/elmo/cal.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/hostnix/elmo/cal.nix b/hostnix/elmo/cal.nix
new file mode 100644
index 0000000..54946a9
--- /dev/null
+++ b/hostnix/elmo/cal.nix
@@ -0,0 +1,35 @@
+{ pkgs, ... }:
+
+{
+ systemd.tmpfiles.rules = [
+ "d /opt/cal 0755 joe users"
+ ];
+
+ systemd.sockets.cal = {
+ wantedBy = [ "sockets.target" ];
+ socketConfig = {
+ ListenStream = "/run/cal/socket";
+ SocketGroup = "nginx";
+ SocketMode = "0660";
+ };
+ };
+
+ systemd.services.cal = {
+ serviceConfig = {
+ Type = "exec";
+ DynamicUser = true;
+ WorkingDirectory = "/opt/cal";
+ StateDirectory = "cal";
+ ExecStart = "${pkgs.nodejs-slim_26}/bin/node server.ts";
+ };
+ };
+
+ # TODO allocate domain?
+ services.nginx.virtualHosts."cal.elmo.mou.fo" = {
+ useACMEHost = "elmo.mou.fo";
+ forceSSL = true;
+ locations."/" = {
+ proxyPass = "http://unix:/run/cal/socket";
+ };
+ };
+}