nix-community/nixos-anywhere

Running extra commands at the end

Closed this issue · 4 comments

My config allows me to ssh only to machines on my tailscale network. Therefore, after running nixos-anywhere on a new remote machine, I'm blocked out of it because I haven't had the opportunity to run tailscale up and log in.

It'd be useful to be able to pass an extra command to run at the end, and output the result.

hmm, thats a bit complicated, since nixos-anywhere doesn't manage the machine which you install with it.
So to run this command we would need to connect to the installed machine. But if that command needs to be run to reach that machine, how can we connect to it to run that command?

Oh right, all the commands are run within the kexec right?
I think I found a solution to my problem: https://tailscale.com/kb/1085/auth-keys. I would need to have a systemd service run the command on start and then remove that service from my conf. Not a beautiful solution but works.

We can close this I guess.

yes all is run in the kexec, I guess you could generate a key locally and copy it with extra-files?

The auth key is just a string I need to pass to the tailscale up command.