-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.nix
56 lines (51 loc) · 1.98 KB
/
default.nix
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
{ lib, this, config, pkgs, ... }: with lib; let
relayPort = 6642;
scripts = [
"autosort.py"
"buffer_autoset.py"
"color_popup.pl"
"colorize_nicks.py"
"go.py"
"highmon.pl"
"screen_away.py"
];
weechat = pkgs.weechat.override {
configure = { availablePlugins, ... }: {
plugins = with availablePlugins; [ python perl ];
init = "/exec -oc cat ${builtins.toFile "weechat-init" ''
/script update
/script install ${concatStringsSep " " scripts}
/mute set sec.crypt.passphrase_command "cat ${config.secrets.weechat.path}"
/mute set relay.network.bind_address ${this.wireguard.ipv4}
/mute set relay.port.weechat ${toString relayPort}
/mute set logger.file.path ${config.synced.irc-logs.path}
''}";
};
};
in {
secrets.weechat = {
owner = my.username;
inherit (config.my) group;
};
systemd.services."weechat-${my.username}" = rec {
description = "WeeChat in a tmux session";
# create a user manager so that /run/user/$uid exists and hence SSH_AUTH_SOCK gets set correctly
wants = [ "user@${toString config.my.uid}.service" "network-online.target" ];
after = wants ++ [ "nss-lookup.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = my.username;
Type = "forking";
ExecStart = "${pkgs.tmux}/bin/tmux -L weechat new-session -s weechat -d ${config.my.shellPath} -lc 'exec ${weechat}/bin/weechat'";
ExecStartPost = "${pkgs.tmux}/bin/tmux -L weechat set-option status off \\; set-option mouse off";
};
restartIfChanged = false;
};
hm.xdg.configFile = mapAttrs' (name: _: {
name = "weechat/${name}";
value.source = config.lib.meta.mkMutableSymlink ./${name};
}) (filterAttrs (name: _: hasSuffix ".conf" name) (builtins.readDir ./.));
networking.firewall.allowedTCPPorts = [ relayPort ];
environment.systemPackages = with pkgs; [ lolcat ];
lib.shellEnv.weechat_fifo = "${config.hm.xdg.cacheHome}/weechat/weechat_fifo";
}