Live data from Hacker News

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

zero-to-nix.com

151–160 of 227 posts

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

#151

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…

> would love to see a discussion from somebody who really likes Nix on why it isn't ready for prime time yet

The daemon needs to be run as root root in a standard multi-user install which rules out HPC-like envs where Nix would actually shine. There are workarounds but none of them official.

Tooling and documentation are on the same level as for a random esoteric programming language. I love Nix but have been hesitant so far to push it at work despite immense productivity gains.

Similarly to HPC, Nix looks like a perfect match for CI/CD pipelines on the surface. In reality the only easy way to get it done is to use additional non-foss software [1].

[1]: https://discourse.nixos.org/t/recommendations-for-introducin...

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

#152

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…

Fragmented documentation. Flakes are still "experimental" and their interface subject to change, but they're also widely acknowledged to be the better way to use Nix. There aren't that many Flakes-first docs, and many existing documents describe things that don't really work with Flakes, so the already incomplete & fragmented docs are even more incomplete & fragmented than it seems at first!

AFAICT, there's no way to use the Flakes-based tools (`nix develop` and such) in the shebang of a script, so you have to stick to legacy Nix when making a shell script or Makefile or Python script that uses Nix to set up the environment. That means no lockfile, which is annoying.

Troubleshooting errors can be a horrible exercise in frustration.

Making derivations for particularly complicated build processes can be a massive pain in the ass.

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

#153
post #7

> Zero to Nix is opinionated because it advocates learning and using flakes and treating channels as deprecated. I think I need a “Channels to Flakes”. I have an existing system configuration that seems to work fine without flakes. What am I missing out on?

https://github.com/Misterio77/nix-starter-configs is probably the closest to that right now.

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

#154
post #147

Earlier quoted context omitted.

Usually you’re on a single-user system anyway though. You should be able to manage all that with your global configuration.nix. You’ll also get the benefit of rollbacks.

Home Manager is nice if you're on non-NixOS, where you don't have a configuration.nix. :)

I use configuration on macos as well, so I'm not sure what you mean?

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

#155

Earlier quoted context omitted.

> 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. Top reasons in my mind: 1. Error messages. Even with my >1 year of experience using NixOS full-time, I've encountered errors that I simply _cannot_ fix. This is getting better (recent nix releases let you introspect probl…

I'm curious, what the is the bend of nix for your dev env vs using a docker container with everything pre-installed

It's a good question, and a very mature/well-engineered Docker dev environment probably gets you near-parity with an equivalent nix setup. That said, my reasons are:

- Although not _all_ of our projects need nix builds in the end, at least a few do, and acquiring their devshells is essentially zero-effort (you just ask nix for the devshell for the package instead of the package output itself)

- As some other commenters have noted, dealing with large container contexts can get hairy/slow. A devshell just tweaks a few environment variables, which is less of a tangle when working on the various projects (I use direnv, so my emacs session hooks into `flake.nix` and finds everything in-path automatically)

- While you could get a bit-for-bit identical dev environments by pushing a built container image to a registry that all devs pull from, I think most people would write a `Dockerfile` once and let folks build it locally before hopping in, which leaves a small (but extant) possibility that some environments may be subtly different (shifting container tags, ad-hoc apt-get commands, etc). A flake.nix coupled with a flake.lock means all devshells are lock-step identical.

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

#156
post #150

Earlier quoted context omitted.

Do you have an idea when the stabilization might come? I've been using flakes for well over a year and there doesn't seem to be much discernible progress.

Because of politics (see RFC 49, 134, 136), I don't see this actually happening that soon. There is agreement in principle to carve out a store only Nix so the no-flakes crowd can build their own UI on it which is held by them as a pre-requisite to any stabilisation of flakes, along with some bad blood of it being announced by blog post. But it's slow because the project maintainer and chief flakes advocate doesn't w…

The Nix team, including the Nix author and chief developer of flakes (upstream in this thread, so be kind all), is also working right now on enabling the nix3 UI for non-flakes setups as well: https://discourse.nixos.org/t/2023-01-16-nix-team-meeting-mi...

Consensus is hard but I'm glad to see people coming together on this. Really looking forward to seeing the new Nix command and flakes move forward (independently)

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

#157
post #132

As a Mac-using Python shop, we had serious file-sync performance issues when mounting our codebase inside a container via docker-compose. Nix completely freed us from them and allowed us to develop with Python natively speedily and without all the serious faff & headaches that usually comes with getting reproducible builds on everyone machines. If you'd like to know more, I spoke at DjangoCon Europe late last year [1…

This is great! Also directly answers some questions commenters have given elsewhere on this submission, e.g., 'why not Docker?'.

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

#159
post #147

Earlier quoted context omitted.

Home Manager is nice if you're on non-NixOS, where you don't have a configuration.nix. :)

I use configuration on macos as well, so I'm not sure what you mean?

Yeah, Home Manager is more redundant if you're using Nix-Darwin for a configuration.nix. Non-NixOS Linux doesn't have an equivalent module system to Nix-Darwin, though, so if you want a module system for declarative config there it's Home Manager.

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

#160

About NixOS, there's something really basic that I cannot seem to grasp. I had already installed many linux distro's with time, after the years I was really found on KDE and ZFS. I've stumbled upon this tutorial with great interests and yet I can't start to see what is the expected install workflow. Are you expected to write your nix config file booting on the live medium, how could you easily transfer this config fi…

Are you referring to impermanence or the erase-your-darlings config?

This tutorial is for Nix itself, not the operating system based on it, which is why it doesn't include install instructions for NixOS.

For a normal NixOS setup with ZFS, traditionally you just partition manually, then mount the datasets how you want for NixOS under /mnt, and the nixos-generate-config command generates a hardware-configuration.nix file which automatically includes all of those mounts for your to-be-installed NixOS system.

You tweak configuration.nix on the target media under /mnt/etc/nixos/configuration.nix, and then run nixos-install and reboot into the new system.

Post reply on HN