1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/systems/makanek/weechat.nix

220 lines
7.2 KiB
Nix
Raw Normal View History

2022-03-10 21:52:12 +01:00
{
lib,
pkgs,
inputs,
2022-03-10 21:52:12 +01:00
...
}: let
inherit (import ../../lib) kieran;
weechatHome = "/var/lib/weechat";
in {
2022-03-10 21:52:12 +01:00
systemd.services.weechat = let
tmux = pkgs.writers.writeDash "tmux" ''
2022-03-10 21:52:12 +01:00
exec ${pkgs.tmux}/bin/tmux -f ${
pkgs.writeText "tmux.conf" ''
set-option -g prefix `
unbind-key C-b
bind ` send-prefix
2022-03-10 21:52:12 +01:00
set-option -g status off
set-option -g default-terminal screen-256color
2022-03-10 21:52:12 +01:00
#use session instead of windows
bind-key c new-session
bind-key p switch-client -p
bind-key n switch-client -n
bind-key C-s switch-client -l
''
} "$@"
'';
weechat = inputs.stockholm.packages.x86_64-linux.weechat-declarative.override {
2021-12-30 03:01:05 +01:00
config = {
scripts = [
pkgs.weechatScripts.weechat-autosort
pkgs.weechatScripts.colorize_nicks
pkgs.weechatScripts.weechat-matrix
(pkgs.callPackage ../../packages/weechatScripts/hotlist2extern.nix {})
2021-12-30 03:01:05 +01:00
];
2022-03-10 21:52:12 +01:00
settings = let
nick = "kmein";
in {
2021-12-30 03:01:05 +01:00
weechat = {
look.mouse = true;
2022-01-18 21:30:52 +01:00
look.prefix_align_max = 15;
2021-12-30 03:01:05 +01:00
color.chat_nick_colors = lib.lists.subtractLists (lib.range 52 69 ++ lib.range 231 248) (lib.range 31 254);
};
irc = {
2022-01-04 21:42:50 +01:00
look = {
server_buffer = "independent";
color_nicks_in_nicklist = true;
};
2021-12-30 03:01:05 +01:00
server_default = {
nicks = nick;
msg_part = "tschö mit ö";
msg_quit = "ciao kakao";
msg_kick = "warum machst du diese?";
2022-01-14 17:26:58 +01:00
realname = lib.head (lib.strings.split " " kieran.name);
2021-12-30 03:01:05 +01:00
};
server = {
hackint = {
autoconnect = true;
addresses = "irc.hackint.org/6697";
2021-12-30 03:01:05 +01:00
ipv6 = true;
ssl = true;
2023-02-16 14:39:03 +01:00
autojoin = ["#eloop" "#krebs" "#hsmr" "#hsmr-moin" "#nixos" "#the_playlist" "#flipdot-berlin" "#hackint"];
2022-02-25 10:11:36 +01:00
sasl_mechanism = "plain";
sasl_username = nick;
sasl_password = "\${sec.data.hackint_sasl}";
2021-12-30 03:01:05 +01:00
};
libera = {
autoconnect = true;
addresses = "irc.libera.chat/6697";
2021-12-30 03:01:05 +01:00
ssl = true;
autojoin = ["#flipdot" "#haskell" "#nixos" "#fysi" "#binaergewitter" "#vim" "#newsboat"];
2021-12-30 03:01:05 +01:00
sasl_mechanism = "plain";
sasl_username = nick;
sasl_password = "\${sec.data.libera_sasl}";
2021-12-30 03:01:05 +01:00
};
oftc = {
autoconnect = true;
addresses = "irc.oftc.net/6697";
2021-12-30 03:01:05 +01:00
ssl = true;
ipv6 = true;
command = lib.concatStringsSep "\\;" [
"/msg nickserv identify \${sec.data.oftc_account}"
2021-12-30 03:01:05 +01:00
"/msg nickserv set cloak on"
];
2022-03-10 21:52:12 +01:00
autojoin = ["#home-manager"];
2021-12-30 03:01:05 +01:00
};
retiolum = {
autoconnect = true;
addresses = "irc.r";
autojoin = ["#xxx" "#brockman" "#flix"];
2021-12-30 03:01:05 +01:00
command = lib.concatStringsSep "\\;" [
"/oper admin aidsballs"
"/msg nickserv always-on true"
"/msg nickserv autoreplay-missed on"
"/msg nickserv auto-away"
];
sasl_mechanism = "plain";
sasl_username = nick;
sasl_password = "\${sec.data.retiolum_sasl}";
2021-12-30 03:01:05 +01:00
};
news = {
autoconnect = true;
addresses = "news.r";
2022-03-10 21:52:12 +01:00
autojoin = ["#cook" "#drachengame" "#oepnv" "#kmeinung" "#memes"];
2021-12-30 03:01:05 +01:00
command = "/oper aids balls";
2022-09-13 21:01:16 +02:00
sasl_mechanism = "plain";
sasl_username = nick;
sasl_password = nick + nick;
2021-12-30 03:01:05 +01:00
};
};
};
logger.level.irc.news = 0;
plugins.var.perl.hotlist2extern = {
external_command_hotlist = "echo %X > ${weechatHome}/hotlist.txt";
external_command_hotlist_empty = "echo -n %X > ${weechatHome}/hotlist.txt";
lowest_priority = "2";
use_title = "off";
delimiter = ",";
};
2021-12-30 03:01:05 +01:00
matrix.server.nibbana = {
address = "nibbana.jp";
username = nick;
password = "\${sec.data.nibbana_account}";
autoconnect = true;
2021-12-30 03:01:05 +01:00
};
alias.cmd.mod = "/quote omode $channel +o $nick";
relay = {
port.weechat = 9000;
network.password = "\${sec.data.relay_password}";
2021-12-30 03:01:05 +01:00
};
filters = {
zerocovid = {
buffer = "irc.news.*";
tags = "*";
2022-01-27 14:06:55 +01:00
regex = "[kc]orona|💉|🤒|😷|[kc]ovid|virus|lockdown|va[kc][sc]in|vaxx|mutante|mutation|impf|pandemi|κορ[ωο]ν[αο]ϊό|корона|expert|infe[ck]t|infizi|in[cz]iden[cz]|sars-cov|drosten|virolog|lauterbach|delta|omi[ck]ron|epidemi|booster|r-wert";
2021-12-30 03:01:05 +01:00
};
smart = {
2021-12-30 03:01:05 +01:00
buffer = "*";
tags = "irc_smart_filter";
2021-12-30 03:01:05 +01:00
regex = "*";
};
playlist_topic = {
buffer = "irc.*.#the_playlist";
tags = "irc_topic";
2021-12-30 03:01:05 +01:00
regex = "*";
};
brockman_notice = {
buffer = "irc.news.*";
tags = "irc_notice";
2021-12-30 03:01:05 +01:00
regex = "*";
};
bots = {
buffer = "irc.retiolum.*";
2022-03-10 21:52:12 +01:00
tags = ["nick_gitlab"];
regex = "*";
};
2022-04-11 23:02:02 +02:00
people = {
buffer = "irc.*.*";
tags = map (name: "nick_${name}") ["mod_p[matrix-fli"];
regex = "*";
};
2021-12-30 03:01:05 +01:00
};
};
extraCommands = ''
/save
/matrix connect nibbana
/connect -all
'';
};
};
in {
description = "Weechat bouncer";
2022-03-10 21:52:12 +01:00
after = ["network.target"];
wantedBy = ["multi-user.target"];
restartIfChanged = true;
2022-03-10 21:52:12 +01:00
path = [pkgs.alacritty.terminfo];
environment.WEECHAT_HOME = weechatHome;
preStart = "${pkgs.coreutils}/bin/rm $WEECHAT_HOME/*.conf";
script = "${tmux} -2 new-session -d -s IM ${weechat}/bin/weechat";
preStop = "${tmux} kill-session -t IM";
serviceConfig = {
User = "weechat";
2022-01-04 21:42:50 +01:00
Group = "weechat";
RemainAfterExit = true;
Type = "oneshot";
};
};
users.groups.weechat = {};
users.extraUsers.weechat = {
useDefaultShell = true;
2022-03-10 21:52:12 +01:00
openssh.authorizedKeys.keys =
kieran.sshKeys pkgs
++ [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC+KVDmYYH7mA8v81e9O3swXm3ZVYY9t4HP65ud61uXy weechat_android@heym"
];
createHome = true;
group = "weechat";
home = "/var/lib/weechat";
isSystemUser = true;
2022-03-10 21:52:12 +01:00
packages = [pkgs.tmux];
};
2022-05-22 11:47:59 +02:00
age.secrets.weechat-sec = {
file = ../../secrets/weechat-sec.conf.age;
path = "/var/lib/weechat/sec.conf";
owner = "weechat";
group = "weechat";
mode = "440";
};
2022-05-22 11:47:59 +02:00
niveum.passport.services = [
{
title = "weechat bouncer";
description = "keeps me logged in on IRC.";
}
];
}