summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/brockman.nix
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/3modules/brockman.nix')
-rw-r--r--krebs/3modules/brockman.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/krebs/3modules/brockman.nix b/krebs/3modules/brockman.nix
new file mode 100644
index 00000000..9b2ed4a7
--- /dev/null
+++ b/krebs/3modules/brockman.nix
@@ -0,0 +1,36 @@
+{ 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;
+ };
+ };
+ };
+}