From 6ef8900af4bca2901f00c718e3ac8ba457348451 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 26 Oct 2021 13:05:49 +0200 Subject: populate file: admit derivations --- lib/types/populate.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/types/populate.nix b/lib/types/populate.nix index 894b8cc..18b5cd8 100644 --- a/lib/types/populate.nix +++ b/lib/types/populate.nix @@ -21,11 +21,15 @@ }; file = lib.mkOption { apply = x: - if lib.types.absolute-pathname.check x + if lib.types.absolute-pathname.check x || lib.types.package.check x then { path = x; } else x; default = null; - type = lib.types.nullOr (lib.types.either lib.types.absolute-pathname source-types.file); + type = lib.types.nullOr (lib.types.oneOf [ + lib.types.absolute-pathname + lib.types.package + source-types.file + ]); }; git = lib.mkOption { default = null; -- cgit v1.2.3 From 9fc8cbf8e826d4c8a118f37202ab3f335341082a Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 19 Nov 2021 23:42:56 +0100 Subject: target: use default port from SSH config This is the expected behavior. The SSH config is also implicitly used for other SSH-related settings. --- lib/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') 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: -- cgit v1.2.3