add var.ssh_options to pass additional SSH options to nixos-rebuild #427
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a Terraform input variable named
ssh_options
to nixos-rebuild (and to the rebuild part of nixos-anywhere)The problem I'm trying to solve is being able to use
gcloud compute ssh
to rebuild NixOS.gcloud compute ssh
is a wrapper aroundssh
that sets a bunch of ssh options to connect to a GCP VM, even if there is no direct connection to it.Example usage:
I'm using a file to pass the SSH options because of this bug in Nix: NixOS/nix#5181. The content of NIX_SSHOPTS is passed to this tokenizer which splits by spaces and doesn't take quoted substrings into account.
This means that something like
NIX_SSHOPTS='-o ProxyCommand="my-ssh-command foo bar"'
wont't work unless the tokenizer is changed upstream.The disadvantage of passing options as a file is that it will break the terraform module for people relying on their
.ssh/config
, unless they copy the ssh options from.ssh/config
to the terraform module. I understand this might be too much of a downside and we might want to change the tokenizer instead.