Files
nixos/home/ssh/config.nix
Torjus Håkestad ca6ceee059
All checks were successful
Run nix flake check / flake-check (push) Successful in 3m7s
Periodic flake update / flake-update (push) Successful in 2m19s
ssh: add controlpath
2025-09-10 09:57:30 +02:00

55 lines
1.2 KiB
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;
enableDefaultConfig = false;
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;
serverAliveInterval = 30;
controlMaster = "auto";
controlPath = "/run/user/%i/ssh-cm-%C";
}
)
);
"bmo.uio.no" = lib.hm.dag.entryBefore [ "*" ] {
hostname = "bmo.uio.no";
forwardAgent = false;
proxyJump = "torjus@rlogin.uio.no";
serverAliveInterval = 30;
controlMaster = "auto";
controlPath = "/run/user/%i/ssh-cm-%C";
};
"*" = {
serverAliveInterval = 30;
controlMaster = "auto";
};
};
};
services.ssh-agent.enable = true;
}