blob: 70d195386f1f2406da7911f9cdd12d4b5da0833b (
plain)
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
|
{ config, pkgs, ... }:
{
nixpkgs.config.packageOverrides = pkgs: {
weechat = pkgs.weechat.override {
extraBuildInputs = with pkgs; [
pythonPackages.potr
];
};
};
systemd.services = {
weechat = {
description = "weechat session";
path = [ pkgs.weechat pkgs.tmux pkgs.coreutils ];
after = [ "networking.target" ];
wantedBy = [ "multi-user.target" ];
environment = {
LANG = "en_US.utf8";
LC_ALL = "en_US.utf8";
TERM = "${pkgs.rxvt_unicode.terminfo}";
};
serviceConfig = {
Type = "oneshot";
User = "orbekk";
RemainAfterExit = true;
Environment = "TMUX_TMPDIR=/run/user/1000";
};
script = ''
tmux -2 new-session -d -s irc "${pkgs.weechat}/bin/weechat"
'';
preStop = ''
# Gently shut down weechat.
# -xf is needed to kill precisely weechat (and not this script).
pkill -SIGTERM -xf "${pkgs.weechat}/bin/weechat"
for i in {1..10}; do
echo "Waiting for weechat to stop"
pgrep -xlf "${pkgs.weechat}/bin/weechat" || break
sleep 1
done
tmux kill-session -t irc || true
'';
};
};
}
|