tv im: add mosh support
This commit is contained in:
parent
37b0c5ae49
commit
3a02da9677
@ -29,6 +29,9 @@ in {
|
||||
default = config.krebs.hosts.nomic;
|
||||
type = lib.types.host;
|
||||
};
|
||||
tv.im.server.mosh.enable = lib.mkEnableOption "tv.im.server.mosh" // {
|
||||
default = true;
|
||||
};
|
||||
tv.im.server.user = lib.mkOption {
|
||||
default = config.krebs.users.tv;
|
||||
type = lib.types.user;
|
||||
@ -38,11 +41,18 @@ in {
|
||||
(lib.mkIf im.client.enable {
|
||||
users.users.${im.client.user.name}.packages = [
|
||||
(pkgs.writeDashBin "im" ''
|
||||
exec ${pkgs.openssh}/bin/ssh \
|
||||
${lib.optionalString im.client.useIPv6 "-6"} \
|
||||
${im.server.user.name}@${lib.head im.server.host.nets.retiolum.aliases} \
|
||||
-t \
|
||||
im
|
||||
${if im.server.mosh.enable then /* sh */ ''
|
||||
exec ${pkgs.mosh}/bin/mosh \
|
||||
${lib.optionalString im.client.useIPv6 "-6"} \
|
||||
${im.server.user.name}@${lib.head im.server.host.nets.retiolum.aliases} \
|
||||
env TERM=${im.client.term} im
|
||||
'' else /* sh */ ''
|
||||
exec ${pkgs.openssh}/bin/ssh \
|
||||
${lib.optionalString im.client.useIPv6 "-6"} \
|
||||
${im.server.user.name}@${lib.head im.server.host.nets.retiolum.aliases} \
|
||||
-t \
|
||||
im
|
||||
''}
|
||||
'')
|
||||
];
|
||||
})
|
||||
@ -54,6 +64,7 @@ in {
|
||||
];
|
||||
};
|
||||
users.users.${im.server.user.name}.packages = [
|
||||
pkgs.mosh
|
||||
(pkgs.writeDashBin "im" ''
|
||||
export PATH=${lib.makeSearchPath "bin" [
|
||||
pkgs.tmux
|
||||
@ -68,5 +79,19 @@ in {
|
||||
'')
|
||||
];
|
||||
})
|
||||
(lib.mkIf im.server.mosh.enable {
|
||||
krebs.setuid.utempter = {
|
||||
filename = "${pkgs.libutempter}/lib/utempter/utempter";
|
||||
owner = "nobody";
|
||||
group = "utmp";
|
||||
mode = "2111";
|
||||
};
|
||||
tv.iptables.extra4.filter.Retiolum = [
|
||||
"-s ${im.client.host.nets.retiolum.ip4.addr} -p udp --dport 60000:61000 -j ACCEPT"
|
||||
];
|
||||
tv.iptables.extra6.filter.Retiolum = [
|
||||
"-s ${im.client.host.nets.retiolum.ip6.addr} -p udp --dport 60000:61000 -j ACCEPT"
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user