about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/workstation/weechat/default.nix25
1 files changed, 16 insertions, 9 deletions
diff --git a/modules/workstation/weechat/default.nix b/modules/workstation/weechat/default.nix
index 2676e4f0aa0c..a214535920a4 100644
--- a/modules/workstation/weechat/default.nix
+++ b/modules/workstation/weechat/default.nix
@@ -3,6 +3,9 @@
 with lib;
 
 let
+  scripts = with pkgs.weechatScripts;
+    [ colorize_nicks go zncplayback ];
+
   networks = [
     "bitlbee" "freenode" "freenode2" "gnome" "hackint" "indymedia" "oftc"
   ];
@@ -88,11 +91,16 @@ let
 
   flattenAttrs = flattenAttrs' ".";
 
+  # If we were to pass --run-command ourselves, it would get forwarded
+  # to WeeChat before the /script loads, so scripts wouldn't be
+  # available and we wouldn't be able to do stuff like set up Matrix.
   cfg = pkgs.runCommand "weechat-config" {} ''
-    ${pkgs.weechat}/bin/weechat-headless -d $out \
-        ${concatMapStringsSep " " (cmd: "-r ${escapeShellArg cmd}") commands} \
-        -r /save \
-        -r /exit
+    ${pkgs.weechat.override {
+      configure = { ... }: {
+        inherit scripts;
+        init = concatStringsSep ";" (commands ++ [ "/save" "/exit" ]);
+      };
+    }}/bin/weechat-headless -d $out
   '';
 
   weechatHome = "${config.users.users.qyliss.home}/state/weechat";
@@ -104,11 +112,10 @@ in
     export WEECHAT_HOME="$HOME/state/weechat"
   '';
 
-  environment.systemPackages = with pkgs; [
-    (weechat.override {
-      configure = { availablePlugins, ... }: {
-        scripts = with weechatScripts;
-          [ colorize_nicks go zncplayback ];
+  environment.systemPackages = [
+    (pkgs.weechat.override {
+      configure = { ...}: {
+        inherit scripts;
       };
     })
   ];