config/users/pbsds/home/profiles/sshuttle.nix

23 lines
749 B
Nix
Raw Normal View History

2024-07-31 01:57:47 +02:00
# https://nix-community.github.io/home-manager/options.html
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
sshuttle
];
programs.bash.initExtra = ''
function vpn (
ip="$(dig +short -x a $1 | tail -n 1)"
set -x
2024-10-02 09:16:03 +02:00
#sshuttle 0.0.0.0/0 --disable-ipv6 --dns -r "$1" -x $ip -x 127.0.0.1 -x 172.0.0.0/8
sshuttle 0.0.0.0/0 ::/0 --dns -r "$1" -x $ip -x 127.0.0.1 -x 172.0.0.0/8
2024-07-31 01:57:47 +02:00
)
if test -f ~/.ssh/config; then
complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" vpn
complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" lvpn
complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" dvpn
fi
'';
}