nixpkgs/pkgs/os-specific/linux/nixos-rebuild
r-vdp 76d4d46b0c
nixos-rebuild: set SSHOPTS earlier so that we resolve the correct hostname
Before, when using things like proxy jumps, we would end up with the hostname of either localhost or the jump host (depending on whether you configure the jumphost in your ssh config file or in the SSHOPTS) instead of the hostname of the target host.

I was running the following command:
```bash
NIX_SSHOPTS='-p 6016 -J username@jumphost' nixos-rebuild --verbose --flake '.#' --target-host localhost --use-remote-sudo --fast build
```

and what was getting built was `nixosConfigurations.<localhost hostname>` instead of `nixosConfigurations.<remote hostname>`, because the SSH connection to determine the hostname didn't have the NIX_SSHOPTS added to it yet.

So I simply moved the logic to set up the tmp dir and set the SSHOPTS a bit higher up.
2024-11-12 16:23:37 +00:00
..
test nixos-rebuild: Fix repl with a relative flake path 2024-04-01 16:29:54 -04:00
_nixos-rebuild nixos-rebuild: add --no-ssh-tty flag 2024-09-04 01:33:03 +08:00
default.nix binlore: migrate override lore to package passthru 2024-07-04 11:15:05 -05:00
nixos-rebuild.8 nixos-rebuild: add --no-ssh-tty flag 2024-09-04 01:33:03 +08:00
nixos-rebuild.sh nixos-rebuild: set SSHOPTS earlier so that we resolve the correct hostname 2024-11-12 16:23:37 +00:00