diff options
author | Kjetil Ørbekk <kj@orbekk.com> | 2019-09-09 18:33:27 -0400 |
---|---|---|
committer | Kjetil Ørbekk <kj@orbekk.com> | 2019-09-09 18:33:34 -0400 |
commit | 64527e1077deeed6c9b206a8f396648def9c591e (patch) | |
tree | 85e91967ba1123fcdc5d443a781b5455cc43b611 /nix-home-config/weechat.nix | |
parent | 8b97d71ae1726c95be9f3ad64b6d2eca9afd8cda (diff) |
home config
Diffstat (limited to 'nix-home-config/weechat.nix')
-rw-r--r-- | nix-home-config/weechat.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/nix-home-config/weechat.nix b/nix-home-config/weechat.nix new file mode 100644 index 0000000..80eec93 --- /dev/null +++ b/nix-home-config/weechat.nix @@ -0,0 +1,37 @@ +{ config, pkgs, ... }: + +{ + systemd.user.startServices = true; + systemd.user.services = { + weechat = { + Unit = { + Description = "Weechat"; + After = [ "networking.target" ]; + }; + + Service = { + Environment = ["TERM=${pkgs.rxvt_unicode.terminfo}" "TMUX_TMPDIR=/run/user/1000"]; + Type = "oneshot"; + RemainAfterExit = "yes"; + ExecStart = "" + pkgs.writeScript "weechat-start" '' + #!${pkgs.stdenv.shell} + ${pkgs.tmux}/bin/tmux -2 new-session -d -s irc "${pkgs.weechat}/bin/weechat" + ''; + ExecStop = "" + pkgs.writeScript "weechat-stop" '' + #!${pkgs.stdenv.shell} + pkill -SIGTERM -xf "${pkgs.weechat}/bin/weechat" + for i in {1..10}; do + echo "Waiting for weechat to stop... $i" + pgrep -xlf "${pkgs.weechat}/bin/weechat" || break + sleep 1 + done + tmux kill-session -t irc || true + ''; + }; + + Install = { + WantedBy = [ "default.target" ]; + }; + }; + }; +}
\ No newline at end of file |