Hello everyone, for a long time, I had been deploying NixOS and devshells using the traditional, non-flake approach. As I had some time a few months ago, I tried flakes and understood why they're so useful.
I had written an "installer script" in Bash that would, depending on hardware detected, add lines to a host-specific-configuration.nix
file which, as it's name suggested, was host-specific and not included in the git tree. This always rubbed me the wrong way as it it was a very hacky solution and also something that couldn't be in the git tree. After getting familiar with Nix, I could easily get rid of this monster from the installer script, leaving it only essential duties like partitioning, formatting, mounting and calling nixos-install
. Everything else was moved from Bash statements to Nix expressions.
Though I haven't yet written a blog about this, you can checkout my configuration repository. It includes the following outputs:
This post was made mostly to help anyone else who stumbles on the same problems I did and hopefully not waste a lot of time because of the widely known documentation issue.
https://github.com/thefossguy/prathams-nixos
https://gitlab.com/thefossguy/prathams-nixos (same thing, mirrored on GitLab)
The obvious next step is to use disko
but I need some more experimentation with it in a feature branch before mass deployment.
Pratham Patel said:
The obvious next step is to use
disko
but I need some more experimentation with it in a feature branch before mass deployment.
Have you looked into disko-install
?
cf. https://nixos.asia/en/nixos-install-oneclick
I do intend to, just need some more time to tinker with. Probably this weekend :)
Update: Added a GitHub workflow to build x86 and arm64 build nightly. workflow file
The only thing that I haven't gotten around (other than the RISC-V issue for my SBCs) is targeting x86 and arm64 Darwin. At the moment, my company laptop is an Intel MBP and will tend to arm64 once I own one. :)
Another update: Added a justfile
to so that I don't need to remember long invocations like nixosConfigurations.bla.bla.bla
:D
Hmm, maybe I should write a blog about this, it was quite an adventure lol
Pratham Patel said:
Hmm, maybe I should write a blog about this, it was quite an adventure lol
Yes.
(Also link back to this zulip topic as reference :-) )
Absolutely!
Part 1 (rationale behind it) is live!
https://blog.thefossguy.com/posts/nixos-migration-with-flakes-01.md
I plan to add some follow-ups for
That doesn’t mean that you cannot lean from it. ;)
A typo?
Shivaraj B H said:
That doesn’t mean that you cannot lean from it. ;)
A typo?
hah yeah, fixed it just now; thanks for pointing it out!
Last updated: Nov 15 2024 at 12:33 UTC