about summary refs log tree commit diff
path: root/ops/nixos/panettone.nix
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-21T23·40-0400
committerglittershark <grfn@gws.fyi>2020-07-23T22·09+0000
commit7101cc5375a15f73966e0ea7ba596cf222cc2947 (patch)
treeb56dd75da102ec11b4d51608af03236a69ae4246 /ops/nixos/panettone.nix
parent974c2e05af96ca2681239e41b1281cdb0d22347f (diff)
feat(ops/nixos): Deploy Panettone to Whitby r/1439
Deploy Panettone to whitby as a systemd service, proxied to from an
nginx virtual host listening at b.tvl.fyi

Change-Id: I69755566151a45120e6b3453751af0e9291fa241
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1339
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'ops/nixos/panettone.nix')
-rw-r--r--ops/nixos/panettone.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/ops/nixos/panettone.nix b/ops/nixos/panettone.nix
new file mode 100644
index 0000000000..009677a9d3
--- /dev/null
+++ b/ops/nixos/panettone.nix
@@ -0,0 +1,34 @@
+{ config, lib, pkgs, ... }:
+
+let
+  cfg = config.services.depot.panettone;
+  depot = config.depot;
+in {
+  options.services.depot.panettone = with lib; {
+    enable = mkEnableOption "Panettone issue tracker";
+
+    port = mkOption {
+      description = "Port on which Panettone should listen";
+      type = types.int;
+      default = 7268;
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    systemd.services.panettone = {
+      wantedBy = [ "multi-user.target" ];
+      script = "${depot.web.panettone}/bin/panettone";
+
+      serviceConfig = {
+        DynamicUser = true;
+        Restart = "always";
+        StateDirectory = "panettone";
+      };
+
+      environment = {
+        PANETTONE_PORT = toString cfg.port;
+        PANETTONE_DATA_DIR = "/var/lib/panettone";
+      };
+    };
+  };
+}