aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix8
-rw-r--r--lib/types/populate.nix8
2 files changed, 12 insertions, 4 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:
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;