Deploy Nix config remotely
I'd like to be able to do this:
# nixos-rebuild --flake ".#tentacool" --target-host sam@tentacool switch
It connects over SSH and starts copying until if fails with:
copying path '/nix/store/0ab7s7la2i4nkfa645prjn19lrx80r6y-linux-5.15.43-modules-shrunk' to 'ssh://sam@tentacool'...
error: cannot add path '/nix/store/0ab7s7la2i4nkfa645prjn19lrx80r6y-linux-5.15.43-modules-shrunk' because it lacks a valid signature
There's a permissions error with --build-host localhost. There's --use-remote-sudo, however this doesn't appear to support doas.
https://github.com/NixOS/nixpkgs/issues/169193#issuecomment-1107925258
https://github.com/samhh/dotfiles/commit/a18deef88f4630b7e2b76a859f2cf9575b4c6c7d
The following now appears to work:
$ NIX_SSHOPTS="-t" nixos-rebuild switch --flake ".#tentacool" --target-host sam@tentacool --use-remote-sudo
The ssh -t bit was described here: https://discourse.nixos.org/t/which-commands-are-required-for-remote-switch/17936/2
Edit: This no longer works...
Something declarative and which doesn't require entering the remote's password would be ideal.
Another option is Cachix Deploy:
- https://blog.cachix.org/posts/2022-07-29-cachix-deploy-public-beta/
- https://discourse.nixos.org/t/cachix-deploy-public-beta/20641/5
deploy-rs is worth trying again: https://github.com/serokell/deploy-rs/pull/207
https://github.com/samhh/dotfiles/commit/8840013bac3f56ebe40af1439bb2046cef9f3355