If you've ever been put off by the difficulty of the language, it's worth checking it out again with AI assistance.
If you've ever been put off by the difficulty of the language, it's worth checking it out again with AI assistance.
I'll admit, even with LLMs to help, the Nix language and NixOS did have a rather steep learning curve, because it's quite different from anything I'd experienced before. But after getting the hang of it, I can't imagine going back to a "normal" OS and I'm very happy I put in the time to get over the initial friction.
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.
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.
9 out 10 times it gets it right on the first shot and my OS is at that point slightly better for the rest of eternity (unless I stop running NixOs, which I don't see happening any time soon). About 2 years of these incremental changes, and some investments on my own part about what tools I really like, has made my OS an absolute joy and breeze to work with.
Nothing compares. It's like having a version of Omarchy, not build by some other dude to fit their world view, but for yourself that co-evolves with your own preferences and tools.
I never saw much point in Nix, but if you put it like that... now I want to try.
This isn't traditionally 'practical'. It's quicker to just install the package, compared to writing a declaration that says to make the package available. (And for ops, Docker images won out in terms of practicality).
Nix also quite a steep learning curve.. I expect a beginner just wants to learn how to write a package in Nix, and not learn about 'derivations', 'instantiation', etc.
Interesting to see LLM coding agents adjust that trade-off: significantly reducing the cost to "write something in Nix", so the benefits become much cheaper.
Luckily LLMs can help with this too. I asked ChatGPT to generate a course with just enough content to help an ordinary NixOS user configure their system, work with Nix code and flakes, and create/modify simple packages (which is rarely needed anyway). Just a few hours of that gave me a much stronger understanding than all the documentation / tutorials I had read before.