about summary refs log blame commit diff
path: root/ops/nixos/panettone.nix
blob: 009677a9d35ad2cb570b5cfea604bd90c7514f3e (plain) (tree)

































                                                            
{ 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";
      };
    };
  };
}