How to change port for SSH based cache?

I’m trying to access my SSH based cache on a different port than 22.
However when I use the following option it can’t connect:

--option substituters "ssh://nix-ssh@zweili.org:2222"

The only thing that worked for connecting with a different port was NIX_SSHOPTS="-p 2222" but I don’t want to set that on a global level.

What is the correct way to change the SSH port for a substituter?

1 Like

The answer is to define the port in ~/.ssh/config for that particular host.
Thanks to @thanegill for providing the answer on Mastodon.

1 Like