Comment on Kubernetes? docker-compose? How should I organize my container services in 2024?
jkrtn@lemmy.ml 9 months agoCould you give a quick example of using NixOS configuration to launch a machine or deploying something remotely? I’m just starting to move beyond a single machine at home. I’d really like to get transition to infra as code.
nico@r.dcotta.eu 9 months ago
I recommend starting with ZeroToNix’s docs and then moving on to nixos.wiki, but here is a minimal, working example that I could deploy to a hetzner VPS that only has nix and ssh installed:
This sets up a machine, configures the usual stuff like the ssh daemon, creates a user, and sets up an nginx server. To deploy it you would run
nixos-rebuild --target-host root@10.0.0.1 switch
. Other tools exist (I use colmena but the idea is the same). Note how easy it was to set up nginx! If I was setting Nomad up, I would just doservices.nomad.enable = true
.As you can see some things you will have to learn (the nix language, what the configs are…) but I think it is worth it.
nopersonalspace@lemmy.world 9 months ago
This is awesome, ZeroToNix is exactly what I was looking for. I’ve been interested in trying NixOS for a while but I always found the documentation obtuse (extensive, which is great, but not super beginner friendly). I’ll give it a try!
nico@r.dcotta.eu 9 months ago
Good luck on your Nix journey! Happy to help if you have questions.
Of all the tech I use, I think Nix is the most ‘avant-garde’ in that it is super different from the usual methods (scripting, stateful things), but works very well once past the paradigm shift and the learning curve that entails.
jkrtn@lemmy.ml 9 months ago
This is such a wealth of information, thank you! I’m really excited to try this out.