SSH won't work in main system

Hi!
I’ve been struggling these few days with remote ssh into a lab server for my class.
My ssh works fine for the few things I have done with it. However for this class I need to do a jump. The command in is “ssh -J eple@firstdomain student14@targetserver”
The command fails with an error from bash of “no such file or directory” and a message that I was disconnected.
I have however temporarily fixed the problem by going into a “nix-shell -p openssh”
This makes the command finally work.
So I ask what happens in the background here when doing a shell, that somehow fixes the problem?

My configuration.nix and home.nix only enables openssh with no other settings
I’ve also deleted my whole .ssh both the one in my ~/.ssh and the one in /etc/ssh/
And after doing this and adding the key back it still won’t work without entering the shell.

The banner exchange at the bottom still appears if I am in the shell, but don’t have the right public key, so it should be irrelevant

I am therefore a bit lost.
The version of the ssh is also the same, and I am on nixos-unstable

Can anyone point me in the right direction to fixing this?