1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-16 08:09:45 +01:00

ssh: add more options

This commit is contained in:
zimbatm 2018-11-24 23:40:25 +01:00 committed by Robert Helgesson
parent fa3d1f98e0
commit 456e2d7ed5
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -8,6 +8,8 @@ let
yn = flag: if flag then "yes" else "no"; yn = flag: if flag then "yes" else "no";
unwords = builtins.concatStringsSep " ";
matchBlockModule = types.submodule ({ name, ... }: { matchBlockModule = types.submodule ({ name, ... }: {
options = { options = {
host = mkOption { host = mkOption {
@ -24,6 +26,15 @@ let
description = "Specifies port number to connect on remote host."; description = "Specifies port number to connect on remote host.";
}; };
forwardAgent = mkOption {
default = null;
type = types.nullOr types.bool;
description = ''
Whether the connection to the authentication agent (if any)
will be forwarded to the remote machine.
'';
};
forwardX11 = mkOption { forwardX11 = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
@ -81,6 +92,15 @@ let
"Set timeout in seconds after which response will be requested."; "Set timeout in seconds after which response will be requested.";
}; };
sendEnv = mkOption {
type = types.listOf types.str;
default = [];
description = ''
Environment variables to send from the local host to the
server.
'';
};
compression = mkOption { compression = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;
default = null; default = null;
@ -118,12 +138,14 @@ let
matchBlockStr = cf: concatStringsSep "\n" ( matchBlockStr = cf: concatStringsSep "\n" (
["Host ${cf.host}"] ["Host ${cf.host}"]
++ optional (cf.port != null) " Port ${toString cf.port}" ++ optional (cf.port != null) " Port ${toString cf.port}"
++ optional (cf.forwardAgent != null) " ForwardAgent ${yn cf.forwardAgent}"
++ optional cf.forwardX11 " ForwardX11 yes" ++ optional cf.forwardX11 " ForwardX11 yes"
++ optional cf.forwardX11Trusted " ForwardX11Trusted yes" ++ optional cf.forwardX11Trusted " ForwardX11Trusted yes"
++ optional cf.identitiesOnly " IdentitiesOnly yes" ++ optional cf.identitiesOnly " IdentitiesOnly yes"
++ optional (cf.user != null) " User ${cf.user}" ++ optional (cf.user != null) " User ${cf.user}"
++ optional (cf.identityFile != null) " IdentityFile ${cf.identityFile}" ++ optional (cf.identityFile != null) " IdentityFile ${cf.identityFile}"
++ optional (cf.hostname != null) " HostName ${cf.hostname}" ++ optional (cf.hostname != null) " HostName ${cf.hostname}"
++ optional (cf.sendEnv != []) " SendEnv ${unwords cf.sendEnv}"
++ optional (cf.serverAliveInterval != 0) ++ optional (cf.serverAliveInterval != 0)
" ServerAliveInterval ${toString cf.serverAliveInterval}" " ServerAliveInterval ${toString cf.serverAliveInterval}"
++ optional (cf.compression != null) " Compression ${yn cf.compression}" ++ optional (cf.compression != null) " Compression ${yn cf.compression}"
@ -144,8 +166,8 @@ in
default = false; default = false;
type = types.bool; type = types.bool;
description = '' description = ''
Whether connection to authentication agent (if any) will be forwarded Whether the connection to the authentication agent (if any)
to remote machine. will be forwarded to the remote machine.
''; '';
}; };