diff --git a/home/ssh/config.nix b/home/ssh/config.nix new file mode 100644 index 0000000..17a2375 --- /dev/null +++ b/home/ssh/config.nix @@ -0,0 +1,35 @@ +{ pkgs, lib, ... }: +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"; + + matchBlocks = { + "bmo.uio.no-on-eduroam" = 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"; + }; + }; + }; +} diff --git a/home/ssh/default.nix b/home/ssh/default.nix index da32aec..d7fe506 100644 --- a/home/ssh/default.nix +++ b/home/ssh/default.nix @@ -1 +1 @@ -{ imports = [ ./gunter.nix ]; } +{ imports = [ ./config.nix ]; } diff --git a/home/ssh/gunter.nix b/home/ssh/gunter.nix deleted file mode 100644 index 71736d1..0000000 --- a/home/ssh/gunter.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, ... }: -{ - programs.ssh = { - enable = true; - controlMaster = "auto"; - - matchBlocks."bmo.uio.no" = { - setEnv = { - # TERM = "xterm-256color"; - }; - hostname = "bmo.uio.no"; - forwardAgent = false; - proxyJump = "torjus@rlogin.uio.no"; - }; - }; -}