From 92d993b5d3a5b38b58d24e3d04234d11a00f3e67 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Wed, 14 Feb 2024 07:45:05 +0530 Subject: hosts/lia/sshfwd/mkFwdSrv: always restart --- hosts/lia/modules/sshfwd.nix | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'hosts/lia/modules/sshfwd.nix') diff --git a/hosts/lia/modules/sshfwd.nix b/hosts/lia/modules/sshfwd.nix index 4140660..582afc7 100644 --- a/hosts/lia/modules/sshfwd.nix +++ b/hosts/lia/modules/sshfwd.nix @@ -17,13 +17,17 @@ # the ssh from dying during switch-to-configuration. stopIfChanged = false; - path = [ pkgs.openssh ]; - script = '' - echo -n "Forwarding port ${toString local_port}" - exec ssh -N ${remote_user}@${remote} -p ${toString ssh_port} \ - -R '[::]:${toString remote_port}:127.0.0.1:${toString local_port}' \ - -i ${key} - ''; + serviceConfig = { + ExecStart = '' + ${pkgs.openssh}/bin/ssh -N ${remote_user}@${remote} -p ${toString ssh_port} \ + -R '[::]:${toString remote_port}:127.0.0.1:${toString local_port}' \ + -i ${key} + ''; + + RestartSec = 1; + Restart = "always"; + }; + }; }; in { -- cgit v1.2.3