about summary refs log tree commit diff
path: root/ops/modules/paroxysm.nix
blob: 070e7623db09574cc499b1ef5ed39d3b85a065ab (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
{ depot, config, lib, pkgs, ... }:

let
  cfg = config.services.depot.paroxysm;
  description = "TVL's majestic IRC bot";
in
{
  options.services.depot.paroxysm.enable = lib.mkEnableOption description;

  config = lib.mkIf cfg.enable {
    systemd.services.paroxysm = {
      inherit description;
      script = "${depot.fun.paroxysm}/bin/paroxysm";
      wantedBy = [ "multi-user.target" ];

      environment = {
        PARX_DATABASE_URL = "postgresql://tvldb:tvldb@localhost/tvldb";
        PARX_IRC_CONFIG_PATH = "/var/lib/paroxysm/irc.toml";
      };

      serviceConfig = {
        DynamicUser = true;
        StateDirectory = "paroxysm";
        Restart = "always";
      };
    };
  };
}