aboutsummaryrefslogtreecommitdiffstats
path: root/lib/default.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-11-20 15:46:09 +0100
committerGitHub <noreply@github.com>2021-11-20 15:46:09 +0100
commit13ae434b140035e7e2664bd5a8ef4c475413b2e0 (patch)
treece553f6ded649b4b33772b4dd6c4d205a27de5ca /lib/default.nix
parentb78e4d5a925d2987b52b33e98c3aeae12c41d019 (diff)
parent9fc8cbf8e826d4c8a118f37202ab3f335341082a (diff)
Merge pull request #35 from erikarvstedt/fix-ssh-port1.26.2
target: use default port from SSH config
Diffstat (limited to 'lib/default.nix')
-rw-r--r--lib/default.nix8
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: