From d6ab6ee3704430db109fa65688e85cde966066b1 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 10 Jan 2018 15:40:07 +0000 Subject: [PATCH] ssh: add extraConfig option for non-standard options --- modules/programs/ssh.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/programs/ssh.nix b/modules/programs/ssh.nix index b2017818..60925153 100644 --- a/modules/programs/ssh.nix +++ b/modules/programs/ssh.nix @@ -95,6 +95,12 @@ let default = null; description = "The command to use to connect to the server."; }; + + extraOptions = mkOption { + type = types.attrsOf types.str; + default = {}; + description = "Extra configuration options for the host."; + }; }; config.host = mkDefault name; @@ -113,6 +119,7 @@ let " ServerAliveInterval ${toString cf.serverAliveInterval}" ++ optional (!cf.checkHostIP) " CheckHostIP no" ++ optional (cf.proxyCommand != null) " ProxyCommand ${cf.proxyCommand}" + ++ mapAttrsToList (n: v: " ${n} ${v}") cf.extraOptions ); in @@ -157,6 +164,14 @@ in ''; }; + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra configuration. + ''; + }; + matchBlocks = mkOption { type = types.loaOf matchBlockModule; default = []; @@ -190,6 +205,8 @@ in ControlPath ${cfg.controlPath} ControlPersist ${cfg.controlPersist} + ${cfg.extraConfig} + ${concatStringsSep "\n\n" ( map matchBlockStr ( builtins.attrValues cfg.matchBlocks))}