Live data from Hacker News

Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

zero-to-nix.com

101–110 of 227 posts

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#101

I wish guides like these contained screenshots. Do people use Nix for desktop OSes? As a VM they SSH into? A collection of config scripts that they don't directly issue commands to? I certainly can't tell from a quick glance of this guide

Zero to Nix introduces Nix, not NixOS the operating system. So, there's not really a need for screen shots as Zero to Nix it teaching how best to install and use Nix on any Linux or macOS. For that, code snippets are convenient I think.

From the questions in the parent post I wonder if it would be good to have a clear definition of what Nix is, what NixOS is, how they're different, and when to use each? Could just be a short paragraph, but if the site is for people just starting out it might be helpful...

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#102
post #2

I read of Nix now and then. Seems its more than a fad. Why should I invest time? What makes it stand out?

> Why should I invest time? It's not for everyone. Specifically, because Nix's 'costs' are upfront (for likely future benefit), nix isn't well suited to just-get-it-done pragmatic attitudes. -- e.g. if you'd prefer to just launch VMs from the web console, over using a tool like Terraform, then Nix isn't going to be for you. Nix isn't too difficult to use . I'd say it's 95% wonderful, 5% huge pain to deal with. (Writi…

> nix isn't well suited to just-get-it-done pragmatic attitudes

Depends on what exactly you're trying to do. I discovered nix years ago when I was trying to install a newer version of Java than was available in the Ubuntu repos, and the "nix-env" method (just using nix as a package manager without the declarative config) was the only thing that just worked with no hassle.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#103

I would love to see a discussion from somebody who really likes Nix on why it isn't ready for prime time yet/just play devil's advocate aloud on why it isn't the greatest thing since sliced bread. I feel like I must not be doing anything "serious" enough to need package reproducibility at that high level. I'm aware of things like git checkout/tags, package-lock.json, Cargo.lock, Docker image tags. What is a real worl…

This is a 100% fair point and I do agree that people can be overzealous with pushing Nix. For many projects, Nix is indeed overkill, and it's worth pointing out that some tools, like pnpm, have taken important cues from Nix. In many cases good enough really _is_ good enough and saying "just install npm using Homebrew or whatever you prefer" is totally fine. But when good enough isn't good enough and teammates and would-be contributors burn an hour installing dependencies just to push a small fix, that's where Nix can really shine. Another sweet spot is larger orgs where knowing that you can run `nix develop` in any repo and get everything you need is a legit superpower.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#104
post #2

I read of Nix now and then. Seems its more than a fad. Why should I invest time? What makes it stand out?

I recommend to sit back and wait until the hype has subsided. Later, when the starting problems subsided and documentation has improved, it might be worth a try. Provided that ever happens.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#105
post #60

Just my two cents: Nix doesn’t guarantee “reproducible”, just “repeatable”. (I think it’s helpful to keep these technical concepts distinct, and to introduce the right terminology when teaching, since it makes elaboration easier in the future.)

would you mind elaborating on the difference?

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#106
I'm trying Nix this weekend, and I'm surprised that many part of the core nixpkgs library are mostly undocumented. For example, searching with `"stdenv.isLinux" site:nixos.org -site:discourse.nixos.org -site:releases.nixos.org` returns a single result in total, which only contain the one usage of the function but no other list of available stdenv.is* functions.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#107
I've been dipping my toes into the Nix ecosystem recently, having a dev environment per project with direnv is neat but how does this work with IDEs like VSCode or IntelliJ IDEA? For example, if I define a specific JDK in my project with Nix, will IntelliJ be able to pick this up? Does anyone have any good resources on how to set this up?

BTW, for others who just want to try it out without having to install anything on your system, there are docker containers you can use as a sandbox: docker run -it nixos/nix bash

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#108

I would love to see a discussion from somebody who really likes Nix on why it isn't ready for prime time yet/just play devil's advocate aloud on why it isn't the greatest thing since sliced bread. I feel like I must not be doing anything "serious" enough to need package reproducibility at that high level. I'm aware of things like git checkout/tags, package-lock.json, Cargo.lock, Docker image tags. What is a real worl…

I love Nix, all of my machines run NixOS, but I think it's 5-10 years out from widespread adoption. Currently the biggest issues have to do with severely lacking documentation, lack of developer tooling (missing things like LSP), very slow iteration cycles, confusing or impossible to understand errors, and even naming (Nix refers to the language, package manager, cli, community, etc).

That said, right now it's still the best tool I've ever used. Nix is great at a few things: reproducible development environments, reproducible builds, and reproducible systems. I introduced Nix at my last job to do most of these things and it helped onboarding dramatically: Nix-based development environments with automatic activation, Nix-based Docker image builds which reuse the work done for the dev environment, and Nix-Darwin configuration to configure systems with one command. It's incredibly powerful and you're able to use as much or as little as you like. So the amount of "overkill" is variable.

Of course, the problem here is that knowledge of Nix itself is necessary to build and maintain these things. Due to the reasons outlined previously, it is quite an investment. I believe it is worth it given the stability, flexibility, and efficiency Nix can provide.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#109

Earlier quoted context omitted.

Can you elaborate? From what I understand, Nix packages are mostly reproducible as they are running great lengths for that, to the point where every time in Nix land is the exact same.

Not bit-for-bit reproducible. Package builds can be nondeterministic, binaries can have embedded timestamps (e.g, build time), and so on. They should be semantically equivalent, but it's not fully guaranteed.

You're not wrong overall, but your example is. In the build environment, the current time is set to the epoch which removes that variability.

An upcoming feature of nix is content addressed builds which use the output hashes to determine the store path. This should make it much more transparent which builds are reproducible and which are not.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#110

I've been dipping my toes into the Nix ecosystem recently, having a dev environment per project with direnv is neat but how does this work with IDEs like VSCode or IntelliJ IDEA? For example, if I define a specific JDK in my project with Nix, will IntelliJ be able to pick this up? Does anyone have any good resources on how to set this up? BTW, for others who just want to try it out without having to install anything…

For vscode, I like the `arrterian.nix-env-selector` extension.

Can IntelliJ be configured to simply use whatever JDK belongs to the `javac` in PATH? If so, it should suffice to simply start it in a `nix-shell`. If not, maybe setting `JAVA_HOME` in your `.envrc` could help?

Post reply on HN