summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/nix-community/mediawiki-matrix-bot.nix
blob: 6dff641210fac3e9aa2afd51b2dc750011c49649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ pkgs, ... }:
let
  seccfg = toString <secrets/mediawikibot-config.json>;
  statecfg = "/var/lib/mediawiki-matrix-bot/config.json";
in {
  systemd.services.mediawiki-matrix-bot = {
    description = "Mediawiki Matrix Bot";
    after = [ "network-online.target" ];
    wantedBy = [ "multi-user.target" ];
    serviceConfig = {
      Restart = "always";
      RestartSec = "60s";
      DynamicUser = true;
      StateDirectory = "mediawiki-matrix-bot";
      PermissionsStartOnly = true;
      ExecStartPre = pkgs.writeDash "mediawikibot-copy-config" ''
        install -D  -m644 ${seccfg} ${statecfg}
      '';
      ExecStart = "${pkgs.mediawiki-matrix-bot}/bin/mediawiki-matrix-bot ${statecfg}";
      PrivateTmp = true;
    };
  };
}