nixos/home/ssh/config.nix
Torjus Håkestad 19f0cd622b
All checks were successful
Run nix flake check / flake-check (push) Successful in 3m3s
Periodic flake update / flake-update (push) Successful in 2m14s
Set ssh option ServerAliveInterval
2025-06-10 11:30:36 +02:00

48 lines
1000 B
Nix

{
pkgs,
lib,
osConfig,
...
}:
let
eduroam-active = pkgs.writeShellApplication {
name = "eduroam-active";
runtimeInputs = with pkgs; [
networkmanager
];
text = ''
nmcli -g GENERAL.STATE c s interface|grep -q -E '\bactiv'
'';
};
in
{
programs.ssh = {
enable = true;
controlMaster = "auto";
serverAliveInterval = 30;
matchBlocks = {
"bmo.uio.no-on-eduroam" = (
lib.mkIf (osConfig.system.name == "magicman") (
lib.hm.dag.entryBefore [ "bmo.uio.no" ] {
match = "host bmo.uio.no exec \"nmcli -g GENERAL.STATE c s eduroam|grep -q -E '\\bactiv'\"";
hostname = "bmo.uio.no";
forwardAgent = false;
}
)
);
"bmo.uio.no" = {
setEnv = {
# TERM = "xterm-256color";
};
hostname = "bmo.uio.no";
forwardAgent = false;
proxyJump = "torjus@rlogin.uio.no";
};
};
};
services.ssh-agent.enable = true;
}