stockholm/krebs/3modules/brockman.nix

36 lines
978 B
Nix
Raw Normal View History

2021-01-24 15:29:40 +00:00
{ pkgs, config, ... }:
with import <stockholm/lib>;
2020-12-30 08:47:57 +00:00
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 {
2021-01-07 23:37:52 +00:00
users.extraUsers.brockman = {
home = "/var/lib/brockman";
createHome = true;
isNormalUser = false;
2021-01-24 15:29:40 +00:00
uid = genid_uint31 "brockman";
2021-01-07 23:37:52 +00:00
};
2020-12-30 08:47:57 +00:00
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";
};
};
};
}