Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I spent like ~6 hours going through the first ~10 chapters of "how to learn nix" and the corresponding docs, and I've built up a decent model of how nix works under the hood but have no knowledge of how to do the things I want to do (reproducible dev environment per project)

Hopefully that'll come in the next ~10 hours, or maybe I need to switch to one of these other learning resources

- Tutorial motivated by accomplishing things [0]

- Learn nix language syntax [1]

- If video is more your thing [2]

- The official "bite-sized guide" Nix Pills [3]

[0] https://nix.dev/

[1] https://nixcloud.io/tour

[2] https://www.youtube.com/playlist?list=PLRGI9KQ3_HP_OFRG6R-p4...

[3] https://nixos.org/guides/nix-pills/#nix-pills



Since "How to Learn Nix" mirrors the (bonkers) presentation order from the official documentation, I am afraid to say that you will not learn how to do this until part 32, deep into the Nixpkgs manual.

https://ianthehenry.com/posts/how-to-learn-nix/builders/

The Nix manual just doesn't talk about this. But the Nixpkgs manual will, eventually. Here's what it has to say:

https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-mkShell

That's it. Nix Pills does cover making development environments in chapter 10:

https://nixos.org/guides/nix-pills/developing-with-nix-shell...

But Nix Pills is not really a "bite-sized guide" so much as a "let's motivate and invent the Nixpkgs genericBuilder infrastructure from scratch." So it doesn't really show you an example of how to write shell.nix files.

Writing reproducible dev environments per project ("shell.nix files") is the main reason I use Nix. But Nix does not... make it very easy, out of the box. There are two more posts (separate from the documentation-reading sections) that will explain how to make this more ergonomic:

- https://ianthehenry.com/posts/how-to-learn-nix/saving-your-s...

- https://ianthehenry.com/posts/how-to-learn-nix/nix-zshell/

(This is slightly unfair because if you're using Nix to build software, not just create a development environment, you get nix-shell for free. mkShell is sort of a special case of "I don't want the final result in the /nix/store; I just want you to put me in a shell with these packages installed." It's not a case that Nix optimizes very well for, even though it is my primary use case.)

Finally, obligatory caveat that everything is completely different now in the "new" (unstable, flakes-based) Nix interface:

https://ianthehenry.com/posts/how-to-learn-nix/nix-develop/


First, I want to say thank you for documenting your learning journey, because it's an excellent resource. [0]

> Since "How to Learn Nix" mirrors the (bonkers) presentation order from the official documentation

Yes, I should have clarified that the complaint is directed at nix docs and not your blog.

> I am afraid to say that you will not learn how to do this until part 32, deep into the Nixpkgs manual.

I was actually feeling a little dejected after my first sprint at learning this. I had skipped ahead to your summary posts ("so I read the manual") and saw that I wasn't even close to learning how to use nix as I wanted.

Some of the comments here actually gave me hope that the juice will be worth the squeeze, so I'll jump back in tonight. I might switch to `nix.dev` tutorial that will hopefully get me moving a bit, and then jump back to your blog and the official docs.

[0] Really, having your stream of conscious helps a lot. Sometimes you explain something a little more in depth or from a different angle, other times your confusion reassures me that I'm not missing something.

I saw you say elsewhere that you feel like these are "low effort" posts compared to your other writing, but it also feels like it's filling a whole in the online-learning landscape. So again, thanks!


Yeah, I think that nix.dev is a much better resource for getting started with Nix quickly.

I wrote How to Learn Nix mostly out of curiosity: I was interested in Nix as a concept, and I didn't really know what it could do going into it. I picked the title long before it became clear that reading the official documentation was not a good way to actually learn how to use Nix. "The Nix Diaries" or something would be a lot more accurate.

That said I don't know what a better approach would look like. nix.dev and tutorials like that are very useful, but my (possibly outdated) understanding is that they never take a step back and explain how or why things work. So you can follow along with what they're doing, following a carefully lain road, but as soon as the road ends you find yourself in the middle of nowhere without a map of your surroundings. (This was how I initially tried to "learn Nix" in 2016, and basically gave up on it -- nix.dev didn't exist back then, but I followed various random online tutorials.)

I think it's a good idea to come at it from both sides, and How to Learn Nix is much more in the "build intuition" camp than the "get something done" camp. I'm glad you're finding it useful, though!


> I wasn't even close to learning how to use nix as I wanted.

> Some of the comments here actually gave me hope that the juice will be worth the squeeze, so I'll jump back in tonight. I might switch to `nix.dev` tutorial that will hopefully get me moving a bit, and then jump back to your blog and the official docs.

FWIW, my learning journey with Nix was copy-pasting snippets and casually getting a deeper understanding as I needed it over months.

The experience with Nix is 95% wonderful, 5% painful. With many other tools, you can use them without really needing to know what's going on. With Nix.. you'll likely end up wanting to do something which will demand you understand stuff. -- Time spent reading the manual isn't wasted.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: