37 lines
1,002 B
Nix
37 lines
1,002 B
Nix
{ pkgs, config, ... }:
|
|
with import <stockholm/lib>;
|
|
let
|
|
cfg = config.krebs.brockman;
|
|
in {
|
|
options.krebs.brockman = {
|
|
enable = mkEnableOption "brockman";
|
|
config = mkOption { type = types.attrs; }; # TODO make real config here
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
users.extraUsers.brockman = {
|
|
home = "/var/lib/brockman";
|
|
createHome = true;
|
|
isNormalUser = false;
|
|
uid = genid_uint31 "brockman";
|
|
};
|
|
|
|
systemd.services.brockman = {
|
|
description = "RSS to IRC broadcaster";
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network-online.target" ];
|
|
serviceConfig = {
|
|
Restart = "always";
|
|
ExecStart = ''
|
|
${pkgs.brockman}/bin/brockman ${pkgs.writeText "brockman.json" (builtins.toJSON cfg.config)}
|
|
'';
|
|
User = config.users.extraUsers.brockman.name;
|
|
PrivateTmp = true;
|
|
RuntimeDirectory = "brockman";
|
|
WorkingDirectory = "%t/brockman";
|
|
RestartSec = 5;
|
|
};
|
|
};
|
|
};
|
|
}
|