1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-14 21:11:08 +01:00

ssh: add setEnv option (#3935)

This commit is contained in:
Gaétan Lepage 2023-05-11 14:22:40 +02:00 committed by GitHub
parent 2f6a917ade
commit 6be873663e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 0 deletions

View file

@ -15,6 +15,12 @@ let
unwords = builtins.concatStringsSep " ";
mkSetEnvStr = envStr: unwords
(mapAttrsToList
(name: value: ''${name}="${escape [ "\"" "\\" ] (toString value)}"'')
envStr
);
bindOptions = {
address = mkOption {
type = types.str;
@ -189,6 +195,14 @@ let
'';
};
setEnv = mkOption {
type = with types; attrsOf (oneOf [ str path int float ]);
default = {};
description = ''
Environment variables and their value to send to the server.
'';
};
compression = mkOption {
type = types.nullOr types.bool;
default = null;
@ -322,6 +336,7 @@ let
++ optional (cf.hostname != null) " HostName ${cf.hostname}"
++ optional (cf.addressFamily != null) " AddressFamily ${cf.addressFamily}"
++ optional (cf.sendEnv != []) " SendEnv ${unwords cf.sendEnv}"
++ optional (cf.setEnv != {}) " SetEnv ${mkSetEnvStr cf.setEnv}"
++ optional (cf.serverAliveInterval != 0)
" ServerAliveInterval ${toString cf.serverAliveInterval}"
++ optional (cf.serverAliveCountMax != 3)