about summary refs log tree commit diff
path: root/ops/nixos/panettone.nix
diff options
context:
space:
mode:
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 000000000000..009677a9d35a
--- /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";
+      };
+    };
+  };
+}