fix(ssh-tunnel): correct type issues
This commit is contained in:
parent
a21809d989
commit
f7780bb80b
1 changed files with 8 additions and 9 deletions
|
@ -14,7 +14,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
requiredBy = mkOption {
|
requiredBy = mkOption {
|
||||||
type = types.list;
|
type = with types; listOf string;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = "List of systemd services that require the SSH tunnels";
|
description = "List of systemd services that require the SSH tunnels";
|
||||||
};
|
};
|
||||||
|
@ -23,17 +23,17 @@ in
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
dynamic = mkOption {
|
dynamic = mkOption {
|
||||||
type = types.list;
|
type = with types; listOf (either int string);
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = "List of dynamic ports to open through the ssh tunnel. See ssh(1) for ``-D``";
|
description = "List of dynamic ports to open through the ssh tunnel. See ssh(1) for ``-D``";
|
||||||
};
|
};
|
||||||
local = mkOption {
|
local = mkOption {
|
||||||
type = types.list;
|
type = with types; listOf (either int string);
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = "List of local ports to open throgh the ssh tunnel. See ssh(1) for ``-L``";
|
description = "List of local ports to open throgh the ssh tunnel. See ssh(1) for ``-L``";
|
||||||
};
|
};
|
||||||
remote = mkOption {
|
remote = mkOption {
|
||||||
type = types.list;
|
type = with types; listOf (either int string);
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = "List of remote ports to open throgh the ssh tunnel. See ssh(1) for ``-R``";
|
description = "List of remote ports to open throgh the ssh tunnel. See ssh(1) for ``-R``";
|
||||||
};
|
};
|
||||||
|
@ -42,15 +42,15 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.systemd.services.ssh-tunnel = mkIf cf.enable (
|
config.systemd.services.ssh-tunnel = mkIf cfg.enable (
|
||||||
let
|
let
|
||||||
mkParams = flag: concatMapStringsSep " " (x: "${flag} x");
|
mkParams = flag: concatMapStringsSep " " (x: "${flag} ${toString x}");
|
||||||
|
|
||||||
dynamic = mkParams "-D" cfg.forwards.dynamic;
|
dynamic = mkParams "-D" cfg.forwards.dynamic;
|
||||||
local = mkParams "-L" cfg.forwards.local;
|
local = mkParams "-L" cfg.forwards.local;
|
||||||
remote = mkParams "-R" cfg.forwards.remote;
|
remote = mkParams "-R" cfg.forwards.remote;
|
||||||
|
|
||||||
options = mkParams "-o" (mapAttrsToList (n: v: "${n}=${v}") {
|
options = mkParams "-o" (mapAttrsToList (n: v: "${n}=${toString v}") {
|
||||||
ServerAliveInterval = 60;
|
ServerAliveInterval = 60;
|
||||||
ExitOnForwardFailure = "yes";
|
ExitOnForwardFailure = "yes";
|
||||||
KbdInteractiveAuthentication = "no";
|
KbdInteractiveAuthentication = "no";
|
||||||
|
@ -58,8 +58,7 @@ in
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.openssh}/bin/ssh ${cfg.server} -NTn \
|
${pkgs.openssh}/bin/ssh ${cfg.server} -NTn ${options} ${dynamic} ${local} ${remote}
|
||||||
${options} ${dynamic} ${local} ${remote}
|
|
||||||
'';
|
'';
|
||||||
requiredBy = cfg.requiredBy;
|
requiredBy = cfg.requiredBy;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue