aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/default.nix2
-rw-r--r--pkgs/krops/default.nix4
-rw-r--r--pkgs/populate/default.nix12
3 files changed, 10 insertions, 8 deletions
diff --git a/lib/default.nix b/lib/default.nix
index bed284d..9fdde0b 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -44,7 +44,7 @@ let {
mkTarget = s: let
default = defVal: val: if val != null then val else defVal;
- parse = lib.match "(([^@]+)@)?(([^:/]+))?(:([^/]+))?(/.*)?" s;
+ parse = lib.match "(([^@]*)@)?(([^:/]+))?(:([^/]+))?(/.*)?" s;
elemAt' = xs: i: if lib.length xs > i then lib.elemAt xs i else null;
in if lib.isString s then {
user = default (lib.getEnv "LOGNAME") (elemAt' parse 1);
diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix
index e72e94c..2c12015 100644
--- a/pkgs/krops/default.nix
+++ b/pkgs/krops/default.nix
@@ -20,9 +20,9 @@ in
remoteCommand = target: command:
exec "build.${target.host}" rec {
filename = "${openssh}/bin/ssh";
- argv = [
+ argv = lib.flatten [
filename
- "-l" target.user
+ (lib.optionals (target.user != "") ["-l" target.user])
"-p" target.port
"-t"
target.host
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix
index 8a383b1..2b283a8 100644
--- a/pkgs/populate/default.nix
+++ b/pkgs/populate/default.nix
@@ -163,8 +163,10 @@ let
--delete-excluded \
"$source_path" \
${quote (
- optionalString (!isLocalTarget target)
- "${target.user}@${target.host}:" +
+ optionalString (!isLocalTarget target) (
+ (optionalString (target.user != "") "${target.user}@") +
+ "${target.host}:"
+ ) +
target.path
)} \
>&2
@@ -180,13 +182,13 @@ let
${ssh' target} ${quote target.host} ${quote script}
'';
- ssh' = target: concatMapStringsSep " " quote [
+ ssh' = target: concatMapStringsSep " " quote (flatten [
"${openssh}/bin/ssh"
- "-l" target.user
+ (optionals (target.user != "") ["-l" target.user])
"-o" "ControlPersist=no"
"-p" target.port
"-T"
- ];
+ ]);
in