about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2020-06-19 12:30:24 +0200
committerProfpatsch <mail@profpatsch.de>2020-06-19 12:30:24 +0200
commitc437da88720fa8226ac5f48efa51a17198a5449a (patch)
tree16ea4b866686c47d3d482d0451b7e52a44158ee1 /modules
parent6a51c6c732593dce3e89c65e84feddbaa0639af3 (diff)
modules/profpatsch/weechat: add wrapExecStart
Diffstat (limited to 'modules')
-rw-r--r--modules/user/profpatsch/programs/weechat.nix18
1 files changed, 14 insertions, 4 deletions
diff --git a/modules/user/profpatsch/programs/weechat.nix b/modules/user/profpatsch/programs/weechat.nix
index f36455ae..51574a9b 100644
--- a/modules/user/profpatsch/programs/weechat.nix
+++ b/modules/user/profpatsch/programs/weechat.nix
@@ -32,15 +32,16 @@ let
         "$0" "$@"
     ];
 
-  startWeechatTmuxSession = writeExecline "start-weechat-tmux-session" {} [
-    "if" [
+  startWeechatTmuxSession = wrapper: writeExecline "start-weechat-tmux-session" {} [
+    "if" ([
       bins.tmux
         "new-session"
           # detach immediately
           "-d"
           "-s" sessionName
+    ] ++ wrapper ++ [
           bins.weechat
-    ]
+    ])
     (until { delaySec = 3; })
       # negate has-session
       "if" "-n" [
@@ -66,6 +67,12 @@ in
       description = "ssh keys that should be able to connect to the weechat tmux session";
       type = lib.types.listOf lib.types.str;
     };
+
+    wrapExecStart = lib.mkOption {
+      description = "bernstein-chaining command wrapped around weechat";
+      type = lib.types.listOf lib.types.str;
+      default = [];
+    };
   };
 
   config = lib.mkIf cfg.enable {
@@ -78,6 +85,9 @@ in
         group = "weechat";
         home = weechatDataDir;
         openssh.authorizedKeys.keys = cfg.authorizedKeys;
+        # give this user access to the bitlbee group and socket
+        # TODO: should not be here I guess.
+        extraGroups = [ "bitlbee" ];
       };
     };
 
@@ -91,7 +101,7 @@ in
     systemd.services.weechat = {
       environment.WEECHAT_HOME = weechatDataDir;
       serviceConfig = {
-        ExecStart = startWeechatTmuxSession;
+        ExecStart = startWeechatTmuxSession cfg.wrapExecStart;
         Restart = "always";
         RestartSec = "3s";
         User = userName;