1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
{ pkgs, lib, ... }:
with lib;
let
networks = [ "bitlbee" "freenode" "gnome" "hackint" "indymedia" "oftc" ];
toWeeChat = value:
/**/ if value == true then "on"
else if value == false then "off"
else if isList value then concatStringsSep "," value
else toString value;
sec = [ "znc.username" "znc.password" "slack.api_tokens" ];
cfgin = {
alias.cmd.B = "buffer";
irc.look.buffer_switch_autojoin = false;
irc.look.display_join_message = false;
irc.look.server_buffer = "independent";
irc.look.temporary_servers = true;
irc.server_default = {
addresses = "znc.qyliss.net/6697";
autoconnect = true;
capabilities = [ "account-notify" "away-notify" "cap-notify" "multi-prefix" "server-time" "znc.in/server-time-iso" "znc.in/self-message" "znc.in/playback" ];
nicks = "qyliss";
password = "\\\${sec.data.znc.password}";
ssl = true;
username = "\\\${sec.data.znc.username}";
};
irc.server = genAttrs networks (s:
{ username = "'\\\${sec.data.znc.username}/${s}'"; });
plugins.var.python.zncplayback.servers = networks;
logger.color.backlog_end = "*default";
logger.look.backlog = 200;
plugins.var.python.slack.slack_api_token = "\\\${sec.data.slack.api_tokens}";
plugins.var.python.slack.auto_open_threads = true;
plugins.var.python.slack.background_load_all_history = true;
plugins.var.python.slack.short_buffer_names = true;
plugins.var.python.slack.show_reaction_nicks = true;
script.look.sort = "p,n";
weechat.bar.buflist.hidden = true;
weechat.bar.fset.items = "fset";
weechat.bar.input.items = "[mode_indicator]+ [input_prompt]+(away),[input_search],[input_paste],input_text";
weechat.bar.status.color_bg = 53;
weechat.bar.status.items = "[otr],[buffer_plugin],buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,scroll,[lag],[hotlist],completion";
weechat.bar.title.color_bg = 53;
weechat.color.chat_nick_colors = [ "cyan" "magenta" "green" "brown" "lightblue" "lightcyan" "lightmagenta" "lightgreen" "blue" ];
weechat.color.chat_nick_self = "default";
weechat.color.status_count_other = "white";
weechat.color.status_data_other = "white";
weechat.color.status_nicklist_count = "white";
weechat.color.status_time = "white";
weechat.completion.default_template = "%(nicks)|%(irc_channels)|%(emoji)";
weechat.completion.nick_completer = ":";
weechat.look.buffer_notify_default = "message";
weechat.look.highlight = [ "spectrum" "crosvm" "qyliss" "alyssa*" "*dntmissher" "*@alyssa" ];
weechat.look.hotlist_names_count = 10;
weechat.look.hotlist_names_level = 14;
weechat.look.mouse = true;
weechat.look.prefix_align_max = 12;
weechat.look.save_config_on_exit = false;
weechat.look.window_title = "WeeChat \\\${info:version}";
};
commands =
map (d: ''/set sec.data.${d} test'') sec ++ [ "/save" ] ++
map (n: "/server add ${n} ${cfgin.irc.server_default.addresses}") networks ++
[ "/ignore add osmbot-test oftc #osm-gb" ] ++
mapAttrsToList (name: value: "/set ${name} ${toWeeChat value}")
(flattenAttrs cfgin);
flattenAttrs' = sep: attrs:
listToAttrs (concatLists (flip mapAttrsToList attrs (k: v:
if isAttrs v then mapAttrsToList (k': nameValuePair "${k}${sep}${k'}") (flattenAttrs' sep v)
else [ (nameValuePair k v) ])));
flattenAttrs = flattenAttrs' ".";
cfg = pkgs.runCommand "weechat-config" {} ''
${pkgs.weechat}/bin/weechat-headless -d $out \
${concatMapStringsSep " " (cmd: "-r ${escapeShellArg cmd}") commands} \
-r /save \
-r /exit
'';
in
{
environment.extraInit = ''
export WEECHAT_HOME="$HOME/state/weechat"
'';
environment.systemPackages = with pkgs; [
(weechat.override {
configure = { availablePlugins, ... }: {
scripts = with weechatScripts;
[ colorize_nicks go wee-slack zncplayback ];
};
})
];
home.qyliss.dirs."state/weechat".activationScripts.config = ''
for file in ${cfg}/*.conf
do
if [ "$file" != ${cfg}/sec.conf ]
then ln -sf $file $(basename $file)
fi
done
'';
}
|