What is your favorite remote NixOS development workflow?

I’m used to running NixOS on a laptop and simply nixos-rebuild switch.
I have embarked on a journey building a NixOS router/firewall appliance which requires different workflows.
I currently:

  • scp configuration.nix and friends to the remote host
  • ssh myrouter ./install.sh where install.sh copies to /etc/nixos and executes nixos-rebuild switch

I’m curious about your workflows or favorite tools for this kind of problem.

nixos-rebuild has a --target-host switch that allows you to build your configuration locally and push it to a host via ssh. Especially for low-powered devices like routers that’s much better.

There are also some nice third party tools like deploy-rs that add some features on top of that (like automated rollbacks if the host becomes unreachable because you broke your ssh service or whatever).


I put all systems in a single flake that is distributed via git. I usually edit/build on the remote host directly, they were all powerful enough for that so far. For small changes using ssh/tmux/vim and for larger things VSCode Remote SSH. Once a chunk is done, the changes are commited and pushed.

1 Like