diff options
author | Erik Arvstedt <erik.arvstedt@gmail.com> | 2021-11-19 23:42:56 +0100 |
---|---|---|
committer | Erik Arvstedt <erik.arvstedt@gmail.com> | 2021-11-20 14:28:54 +0100 |
commit | 9fc8cbf8e826d4c8a118f37202ab3f335341082a (patch) | |
tree | ce553f6ded649b4b33772b4dd6c4d205a27de5ca /lib/default.nix | |
parent | 05f0d3b5c1d38fbbd53142362a7821cc8bc1150a (diff) |
target: use default port from SSH config
This is the expected behavior.
The SSH config is also implicitly used for other SSH-related settings.
Diffstat (limited to 'lib/default.nix')
-rw-r--r-- | lib/default.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/default.nix b/lib/default.nix index 357f5b5..3bbd754 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -57,9 +57,9 @@ let { elemAt' = xs: i: if lib.length xs > i then lib.elemAt xs i else null; filterNull = lib.filterAttrs (n: v: v != null); in { - user = lib.getEnv "LOGNAME"; + user = lib.maybeEnv "LOGNAME" null; host = lib.maybeEnv "HOSTNAME" (lib.maybeHostName "localhost"); - port = "22"; + port = null; path = "/var/src"; sudo = false; extraOptions = []; @@ -70,6 +70,10 @@ let { path = elemAt' parse 6; } else s); + mkUserPortSSHOpts = target: + (lib.optionals (target.user != null) ["-l" target.user]) ++ + (lib.optionals (target.port != null) ["-p" target.port]); + shell = let isSafeChar = lib.testString "[-+./0-9:=A-Z_a-z]"; quoteChar = c: |