From f7780bb80b3257358a024939b7410eb98b4f7f1b Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Wed, 20 Oct 2021 13:41:45 -0400 Subject: [PATCH] fix(ssh-tunnel): correct type issues --- modules/ssh-tunnel.nix | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/ssh-tunnel.nix b/modules/ssh-tunnel.nix index 21de4f6..a5e6650 100644 --- a/modules/ssh-tunnel.nix +++ b/modules/ssh-tunnel.nix @@ -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 = {