mirror of
https://github.com/nix-community/home-manager
synced 2024-12-25 03:09:47 +01:00
ssh: add setEnv option (#3935)
This commit is contained in:
parent
2f6a917ade
commit
6be873663e
3 changed files with 20 additions and 0 deletions
|
@ -15,6 +15,12 @@ let
|
||||||
|
|
||||||
unwords = builtins.concatStringsSep " ";
|
unwords = builtins.concatStringsSep " ";
|
||||||
|
|
||||||
|
mkSetEnvStr = envStr: unwords
|
||||||
|
(mapAttrsToList
|
||||||
|
(name: value: ''${name}="${escape [ "\"" "\\" ] (toString value)}"'')
|
||||||
|
envStr
|
||||||
|
);
|
||||||
|
|
||||||
bindOptions = {
|
bindOptions = {
|
||||||
address = mkOption {
|
address = mkOption {
|
||||||
type = types.str;
|
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 {
|
compression = mkOption {
|
||||||
type = types.nullOr types.bool;
|
type = types.nullOr types.bool;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -322,6 +336,7 @@ let
|
||||||
++ optional (cf.hostname != null) " HostName ${cf.hostname}"
|
++ optional (cf.hostname != null) " HostName ${cf.hostname}"
|
||||||
++ optional (cf.addressFamily != null) " AddressFamily ${cf.addressFamily}"
|
++ optional (cf.addressFamily != null) " AddressFamily ${cf.addressFamily}"
|
||||||
++ optional (cf.sendEnv != []) " SendEnv ${unwords cf.sendEnv}"
|
++ optional (cf.sendEnv != []) " SendEnv ${unwords cf.sendEnv}"
|
||||||
|
++ optional (cf.setEnv != {}) " SetEnv ${mkSetEnvStr cf.setEnv}"
|
||||||
++ optional (cf.serverAliveInterval != 0)
|
++ optional (cf.serverAliveInterval != 0)
|
||||||
" ServerAliveInterval ${toString cf.serverAliveInterval}"
|
" ServerAliveInterval ${toString cf.serverAliveInterval}"
|
||||||
++ optional (cf.serverAliveCountMax != 3)
|
++ optional (cf.serverAliveCountMax != 3)
|
||||||
|
|
|
@ -5,6 +5,7 @@ Host * !github.com
|
||||||
Host abc
|
Host abc
|
||||||
ProxyJump jump-host
|
ProxyJump jump-host
|
||||||
Host xyz
|
Host xyz
|
||||||
|
SetEnv BAR="_bar_ 42" FOO="foo12"
|
||||||
ServerAliveInterval 60
|
ServerAliveInterval 60
|
||||||
ServerAliveCountMax 10
|
ServerAliveCountMax 10
|
||||||
IdentityFile file
|
IdentityFile file
|
||||||
|
|
|
@ -35,6 +35,10 @@ with lib;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
dynamicForwards = [{ port = 2839; }];
|
dynamicForwards = [{ port = 2839; }];
|
||||||
|
setEnv = {
|
||||||
|
FOO = "foo12";
|
||||||
|
BAR = "_bar_ 42";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
"* !github.com" = {
|
"* !github.com" = {
|
||||||
|
|
Loading…
Reference in a new issue