stockholm/lass/2configs/weechat.nix

58 lines
1.4 KiB
Nix
Raw Normal View History

2017-12-31 01:42:01 +00:00
with (import <stockholm/lib>);
2015-10-03 19:22:07 +00:00
{ config, lib, pkgs, ... }:
2016-02-21 13:31:12 +00:00
let
2017-12-31 01:42:01 +00:00
tmux = pkgs.writeDash "tmux" ''
exec ${pkgs.tmux}/bin/tmux -f ${pkgs.writeText "tmux.conf" ''
set-option -g prefix `
unbind-key C-b
bind ` send-prefix
set-option -g status off
set-option -g default-terminal screen-256color
#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
''} "$@"
'';
2016-02-21 13:31:12 +00:00
in {
2015-10-03 19:22:07 +00:00
users.extraUsers.chat = {
home = "/home/chat";
2016-02-21 13:31:12 +00:00
uid = genid "chat";
2015-10-03 19:22:07 +00:00
useDefaultShell = true;
createHome = true;
2017-10-01 16:39:38 +00:00
openssh.authorizedKeys.keys = with config.krebs.users; [
lass.pubkey
lass-shodan.pubkey
lass-icarus.pubkey
lass-android.pubkey
2015-10-03 19:22:07 +00:00
];
};
2015-11-13 13:57:19 +00:00
2017-10-03 11:43:31 +00:00
# mosh
krebs.iptables.tables.filter.INPUT.rules = [
{ predicate = "-p udp --dport 60000:61000"; target = "ACCEPT";}
2017-12-31 01:42:01 +00:00
{ predicate = "-p tcp --dport 9999"; target = "ACCEPT";}
2017-10-03 11:43:31 +00:00
];
2017-12-31 01:42:01 +00:00
systemd.services.chat = {
description = "chat environment setup";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
2015-11-13 13:57:19 +00:00
2017-12-31 01:42:01 +00:00
restartIfChanged = false;
2015-11-13 13:57:19 +00:00
2017-12-31 01:42:01 +00:00
serviceConfig = {
User = "chat";
RemainAfterExit = true;
Type = "oneshot";
ExecStart = "${tmux} -2 new-session -d -s IM ${pkgs.weechat}/bin/weechat";
ExecStop = "${tmux} kill-session -t IM";
};
};
2015-10-03 19:22:07 +00:00
}