5 ms·
Is there a good book that explains Nix, from theory to real world dev usage?
by GoOnThenDoTell 4y ago
Is there a good book that explains Nix, from theory to real world dev usage?
- qbasic_forever 4y agoI've gotten into it recently by skimming the docs, then diving in and using flakes. All of this from a multi-user/single user install on linux, I'm not ready to jump into managing the full OS yet. But IMHO I would try to take a flake centric approach because there's a _ton_ of cruft in the docs about stuff like channels that all gets completely jettisoned and dropped once flakes are the norm. It's just a lot of concepts and CLI commands, flags, rituals, etc. in the docs that will give you nothing of value in a flakes world. Unfortunately there are no real docs that make this clear that the nix world is deep into a major transition and flakes are the clear future. This 1 page intro to the nix language was all I needed to get comfortable with it too: https://github.com/tazjin/nix-1p https://github.com/tazjin/nix-1p It's really a pretty simple data-oriented language when you get down to it.
- JamesSwift 4y ago> It's really a pretty simple data-oriented language when you get down to it Yes, if you think of nix-the-language as a bunch of helpers that creates a big key-value JSON object then you will start to get a better mental model.
- massysett 4y agoThis is what scares me off from Nix every single time. Even the biggest Nix fans keep saying that the docs are terrible. When I do try Nix people say “oh don’t do it that way, even though that’s what the docs say, now the way to do it is this new way.” I can never imagine how Nix is going to help me enough to make it worthwhile to endure this hazing.
- qbasic_forever 4y agoIt's aggravating and kept me away from it for a while too. Try out small isolated parts of it like nix-shell and the flakes version of it nix develop. You can play with that stuff without having to dive in and commit moving all your existing home and other environments to it. Basically just get a little sandbox going to experiment with until you're more confident in doing more with it (or you might find you don't need it and didn't waste much effort/time).
- JamesSwift 4y agoIts much better than in the past, really in a night-and-day way. At least thats been my experience after bouncing in-and-out over 5-6 years and finally sticking with it about 2 years ago.
- rgoulter 4y ago> When I do try Nix people say “oh don’t do it that way, even though that’s what the docs say, now the way to do it is this new way.” What were you trying to do such that the way the docs said to do it was wrong?
- dizhn 4y agoEven simple things like how to install a package.
- otabdeveloper4 4y agoMost people who use Nix don't ever "install packages". It's a very niche and weird thing to want to do, so yes, you won't find good documentation.
- dizhn 4y agohttps://nixos.org/manual/nix/stable/introduction.html https://nixos.org/manual/nix/stable/introduction.html "package manager" is literally in the first sentence.
- rgoulter 4y agoRight. Installing packages isn't a niche or weird thing in any way. Nix does have equivalents to "apt install <package>", etc... but, it's prone to "I forgot I did that / I didn't know I did that", and problems arising from that. (Other distribution package managers like apt-get or pacman require installing packages as root; but with nix packages should be installed as non-root. And the nix command to update installed packages isn't intuitive). What's typically encouraged is to instead install packages as part of the NixOS configuration, or as part of a home-manager configuration. Or, just using commands like "nix shell nixpkgs#<package>", which just adds the program to the path in the current shell, without installing it. (Which is a neat feature of nix).
- qbasic_forever 4y agoArguably anything in the docs that say "Run nix-env ..." is wrong, or at least not the flakes way of doing things. It would be much more clear if the docs just came out and said "nix-env is deprecated, move to flakes, here's where to read the flakes way to do things".
- tmountain 4y agoI've been out of the loop with Nix for a little while now, but I was maintaining roughly a half dozen packages for a little while (including semi-complex u-boot stuff), and I learned everything I needed to know from this tutorial. https://nixos.org/guides/nix-pills/ https://nixos.org/guides/nix-pills/
- breakds 4y agoI would second this. Learning nix takes time and practice, but is very rewarding. Reading the nix pills series is definitely the most helpful first step. I would also recommend https://discourse.nixos.org/ https://discourse.nixos.org/ where kind fellow Nix users constantly answer questions and give advice.
- SkyMarshal 4y agoEelco Dolstra's original PhD Thesis that started it all is worth a read: https://edolstra.github.io/pubs/phd-thesis.pdf https://edolstra.github.io/pubs/phd-thesis.pdf https://philandstuff.github.io/pf-deployment/#/ https://philandstuff.github.io/pf-deployment/#/
- baby 4y agoI think nix pills