stockholm/krebs/3modules/brockman.nix

40 lines
1.1 KiB
Nix
Raw Normal View History

2023-06-10 10:50:53 +00:00
{ pkgs, config, lib, ... }:
with lib;
2020-12-30 08:47:57 +00:00
let
2023-06-10 10:50:53 +00:00
slib = import ../../lib/pure.nix { inherit lib; };
2020-12-30 08:47:57 +00:00
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";
2021-12-01 17:29:24 +00:00
group = "brockman";
2021-01-07 23:37:52 +00:00
createHome = true;
2021-06-05 11:12:18 +00:00
isSystemUser = true;
2023-06-10 10:50:53 +00:00
uid = slib.genid_uint31 "brockman";
2021-01-07 23:37:52 +00:00
};
2021-12-01 17:29:24 +00:00
users.groups.brockman = {};
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";
RestartSec = 5;
2020-12-30 08:47:57 +00:00
};
};
};
}