fix(ssh-tunnel): correct type issues

This commit is contained in:
Infinidoge 2021-10-20 13:41:45 -04:00
parent a21809d989
commit f7780bb80b

View file

@ -14,7 +14,7 @@ in
};
requiredBy = mkOption {
type = types.list;
type = with types; listOf string;
default = [ ];
description = "List of systemd services that require the SSH tunnels";
};
@ -23,17 +23,17 @@ in
type = types.submodule {
options = {
dynamic = mkOption {
type = types.list;
type = with types; listOf (either int string);
default = [ ];
description = "List of dynamic ports to open through the ssh tunnel. See ssh(1) for ``-D``";
};
local = mkOption {
type = types.list;
type = with types; listOf (either int string);
default = [ ];
description = "List of local ports to open throgh the ssh tunnel. See ssh(1) for ``-L``";
};
remote = mkOption {
type = types.list;
type = with types; listOf (either int string);
default = [ ];
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
mkParams = flag: concatMapStringsSep " " (x: "${flag} x");
mkParams = flag: concatMapStringsSep " " (x: "${flag} ${toString x}");
dynamic = mkParams "-D" cfg.forwards.dynamic;
local = mkParams "-L" cfg.forwards.local;
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;
ExitOnForwardFailure = "yes";
KbdInteractiveAuthentication = "no";
@ -58,8 +58,7 @@ in
in
{
script = ''
${pkgs.openssh}/bin/ssh ${cfg.server} -NTn \
${options} ${dynamic} ${local} ${remote}
${pkgs.openssh}/bin/ssh ${cfg.server} -NTn ${options} ${dynamic} ${local} ${remote}
'';
requiredBy = cfg.requiredBy;
serviceConfig = {