about summary refs log tree commit diff
path: root/modules/workstation/weechat/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-26 17:03:27 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-26 17:21:45 +0000
commit7b592134c09ae63eabc6ca43065a6596a0e42352 (patch)
tree746a8ca7dde7bad27a608e1cacc36948bad1506a /modules/workstation/weechat/default.nix
parentd61ccff02fe922824104ea74bc8ee172760ffd58 (diff)
downloadnixlib-7b592134c09ae63eabc6ca43065a6596a0e42352.tar
nixlib-7b592134c09ae63eabc6ca43065a6596a0e42352.tar.gz
nixlib-7b592134c09ae63eabc6ca43065a6596a0e42352.tar.bz2
nixlib-7b592134c09ae63eabc6ca43065a6596a0e42352.tar.lz
nixlib-7b592134c09ae63eabc6ca43065a6596a0e42352.tar.xz
nixlib-7b592134c09ae63eabc6ca43065a6596a0e42352.tar.zst
nixlib-7b592134c09ae63eabc6ca43065a6596a0e42352.zip
modules/weechat: load scripts when making config
Diffstat (limited to 'modules/workstation/weechat/default.nix')
-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;
       };
     })
   ];