5 ms·
You can also push deployments to remote systems which is great for servers and headless devices like raspberry pis. I use colmena and deploy-rs on different pro
by dhon_ 2mo ago
You can also push deployments to remote systems which is great for servers and headless devices like raspberry pis. I use colmena and deploy-rs on different projects because they have some nice features but you can also do it with bare nix.
I have a repo for kiosk appliances that can build an SD card image for a specific device in a fleet (so no on device configuration is required) but it can also push out updates or changes at runtime. NixOS isn't perfect for embedded devices yet but works well for cases like this in my experience.
- bergkvist 2mo agoIf you are using an Apple Silicon laptop and you want to deploy to an x86-64 Linux box, this can get a bit annoying due needing to deal with cross compilation in nix.
- graham33 2mo agoYou can have an x86-64 remote builder, or use a service like nixbuild.net, rather than use cross-compilation.
- JamesSwift 2mo agoYou can easily spin up a linux builder vm or I just have a dedicated remote builder on my network which I offload to
- diarrhea 2mo agoThe Make target I use to deploy in this manner (MacBook to x86-64, single machine) is simply: server: @echo "Deploying machine (with ssh-agent forwarding): '$(MACHINE)'" NIX_SSHOPTS="-A" \ nix run nixpkgs#nixos-rebuild -- switch \ --flake .#$(MACHINE) \ --target-host $(MACHINE).$(DOMAIN) \ --build-host $(MACHINE).$(DOMAIN) \ --no-reexec \ --verbose \ --sudo Which has been working well. I admit I do not understand what all of these flags do in detail. This uses ssh agent forwarding, and then sudo via PAM. That allows for passwordless sudo. Building (well, activating) without sudo is pretty involved last I checked, I could not get it to work.