From 87d306bb33e7f730666f39bc4f5671a20f720f60 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Tue, 2 Jun 2026 17:21:29 -0400 Subject: [PATCH] portfwd --- packages/portfwd.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 packages/portfwd.nix diff --git a/packages/portfwd.nix b/packages/portfwd.nix new file mode 100644 index 0000000..3e43f76 --- /dev/null +++ b/packages/portfwd.nix @@ -0,0 +1,20 @@ +{ writeShellApplication, openssh, ... }: + +writeShellApplication { + name = "portfwd"; + meta.description = '' + Forward a local port to the same port on a remote host over SSH. + Usage: portfwd [host] (host defaults to pureintent) + e.g. `portfwd 7721` or `portfwd 7721 sincereintent` + ''; + runtimeInputs = [ openssh ]; + text = '' + if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then + echo "usage: portfwd [host]" >&2 + exit 1 + fi + port="$1" + host="''${2:-pureintent}" + ssh -L "$port:localhost:$port" "$host" + ''; +}