From 33dbdc346272cf736ff7c3afc927c18a6158ec0a Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Tue, 16 Jan 2024 10:57:26 +0800 Subject: [PATCH] home: custom ssh proxy for different machines --- home/lyc/configurations/aplaz/default.nix | 5 +++++ home/lyc/configurations/aplaz/ssh-proxy.nix | 15 +++++++++++++++ home/lyc/modules/programs/ssh.nix | 3 +-- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 home/lyc/configurations/aplaz/ssh-proxy.nix diff --git a/home/lyc/configurations/aplaz/default.nix b/home/lyc/configurations/aplaz/default.nix index f7c4bbb..f56cfef 100644 --- a/home/lyc/configurations/aplaz/default.nix +++ b/home/lyc/configurations/aplaz/default.nix @@ -1,5 +1,10 @@ { pkgs, config, lib, ... }: { + + imports = [ + ./ssh-proxy.nix + ]; + services.kdeconnect.enable = true; programs.vscode = { diff --git a/home/lyc/configurations/aplaz/ssh-proxy.nix b/home/lyc/configurations/aplaz/ssh-proxy.nix new file mode 100644 index 0000000..cd7b82c --- /dev/null +++ b/home/lyc/configurations/aplaz/ssh-proxy.nix @@ -0,0 +1,15 @@ +{ ... }: +let + metisProxyICT = "llvmws.lyc.dev:20179"; + metisProxySW = "llvmws.lyc.dev:20178"; + proxyCommandSW = "nc -x ${metisProxySW} %h %p"; + proxyCommandICT = "nc -x ${metisProxyICT} %h %p"; +in +{ + programs.ssh.matchBlocks = { + ict-malcon.proxyCommand = proxyCommandICT; + ict-sw.proxyCommand = proxyCommandICT; + ict-repo.proxyCommand = proxyCommandICT; + swyjs.proxyCommand = proxyCommandSW; + }; +} diff --git a/home/lyc/modules/programs/ssh.nix b/home/lyc/modules/programs/ssh.nix index f18a07f..0bb9a7c 100644 --- a/home/lyc/modules/programs/ssh.nix +++ b/home/lyc/modules/programs/ssh.nix @@ -24,7 +24,7 @@ port = 20122; }; adrastea = { - hostname = "adrastea.lyc.dev"; + hostname = "10.231.0.2"; user = "lyc"; port = 22; }; @@ -33,7 +33,6 @@ hostname = "40.0.1.110"; user = "swyjs"; port = 22; - proxyCommand = "nc -x 127.0.0.1:1081 %h %p"; }; ict-malcon = { hostname = "10.3.2.104";