summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/brockman.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-01-18 15:24:18 +0100
committertv <tv@krebsco.de>2021-01-18 15:24:18 +0100
commitff6f5ef5e1cdbd27b2211c54643fa2754f888cbb (patch)
treeb33763a7ac8040efe988f8bed2fe1c649cc155dd /krebs/3modules/brockman.nix
parent7b7ebd8708885633c926c21a4b71d5d4ce8931cf (diff)
parent2a32b7731496615e43a06ec1049f6716c49a1999 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/3modules/brockman.nix')
-rw-r--r--krebs/3modules/brockman.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/krebs/3modules/brockman.nix b/krebs/3modules/brockman.nix
new file mode 100644
index 000000000..55e8255b4
--- /dev/null
+++ b/krebs/3modules/brockman.nix
@@ -0,0 +1,34 @@
+{ pkgs, lib, config, ... }:
+with 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;
+ };
+
+ 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";
+ };
+ };
+ };
+}