From 7b592134c09ae63eabc6ca43065a6596a0e42352 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 26 Jan 2021 17:03:27 +0000 Subject: modules/weechat: load scripts when making config --- modules/workstation/weechat/default.nix | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'modules/workstation/weechat/default.nix') 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; }; }) ]; -- cgit 1.4.1