about summary refs log tree commit diff
path: root/ops/nixos/panettone.nix
blob: 009677a9d35ad2cb570b5cfea604bd90c7514f3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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";
      };
    };
  };
}