ssh: add a few more options

This commit is contained in:
John Wiegley 2018-01-05 16:41:44 -08:00 committed by Robert Helgesson
parent a93445f3fe
commit b8b595c6b2
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -81,6 +81,12 @@ let
"Set timeout in seconds after which response will be requested.";
};
compression = mkOption {
type = types.bool;
default = false;
description = "Specifies whether to use compression.";
};
checkHostIP = mkOption {
type = types.bool;
default = true;
@ -117,6 +123,7 @@ let
++ optional (cf.hostname != null) " HostName ${cf.hostname}"
++ optional (cf.serverAliveInterval != 0)
" ServerAliveInterval ${toString cf.serverAliveInterval}"
++ optional cf.compression " Compression yes"
++ optional (!cf.checkHostIP) " CheckHostIP no"
++ optional (cf.proxyCommand != null) " ProxyCommand ${cf.proxyCommand}"
++ mapAttrsToList (n: v: " ${n} ${v}") cf.extraOptions
@ -139,6 +146,44 @@ in
'';
};
compression = mkOption {
default = false;
type = types.bool;
description = "Specifies whether to use compression.";
};
serverAliveInterval = mkOption {
type = types.int;
default = 0;
description = ''
Set default timeout in seconds after which response will be requested.
'';
};
hashKnownHosts = mkOption {
default = false;
type = types.bool;
description = ''
Indicates that
<citerefentry>
<refentrytitle>ssh</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
should hash host names and addresses when they are added to
the known hosts file.
'';
};
userKnownHostsFile = mkOption {
type = types.str;
default = "~/.ssh/known_hosts";
description = ''
Specifies one or more files to use for the user host key
database, separated by whitespace. The default is
<filename>~/.ssh/known_hosts</filename>.
'';
};
controlMaster = mkOption {
default = "no";
type = types.enum ["yes" "no" "ask" "auto" "autoask"];
@ -201,6 +246,10 @@ in
config = mkIf cfg.enable {
home.file.".ssh/config".text = ''
ForwardAgent ${yn cfg.forwardAgent}
Compression ${yn cfg.compression}
ServerAliveInterval ${toString cfg.serverAliveInterval}
HashKnownHosts ${yn cfg.hashKnownHosts}
UserKnownHostsFile ${cfg.userKnownHostsFile}
ControlMaster ${cfg.controlMaster}
ControlPath ${cfg.controlPath}
ControlPersist ${cfg.controlPersist}