Live data from Hacker News

20 years of Nix

20th.nixos.org

31–40 of 113 posts

Re: 20 years of Nix

#32

Doe nix work at all? Or is it just not actually functional on top of MacOS? I've tried a dozen times over the years and I've never gotten it working. Seriously, how is anything so hard to use still around after 20 years!

You might want to give the new installer by Determinate Systems a try: https://determinate.systems/posts/determinate-nix-installer

[deleted]

Re: 20 years of Nix

#33

Doe nix work at all? Or is it just not actually functional on top of MacOS? I've tried a dozen times over the years and I've never gotten it working. Seriously, how is anything so hard to use still around after 20 years!

I’ve never had an issue with Nix itself on macOS but there are occasionally packages that are broken on macOS but work on Linux - despite upstream supporting macOS.

Re: 20 years of Nix

#34
post #2

20 years, is that the compile time now? ;)

Sarcasm aside, here’s a Nix manual from 2004: https://releases.nixos.org/nix/nix-0.5/manual/manual.html . (The compile time of Nix itself is unpleasant, but not exactly exceptional among programs written in the modern C++ style. The eval time even for Nixpkgs even on a ten-year-old i5 is annoying but not a terrible problem the way it’s used now, though even on a recent Android device it’s admittedly measured in minut…

With the Hydra binary cache I can quite comfortably update my Avoton C2550 based router or Raspberry Pi 4 AirPlay receiver within a few minutes. It’s only if I need to build a non trivial package that I have to make sure I build on my desktop or in a VM on my MacBook.

Re: 20 years of Nix

#35
post #19

Earlier quoted context omitted.

Hey! We've been working at Cachix to address this using https://devenv.sh/ . It's primary targeted to improve DX and on-board users quickly.

DevEnv looks neat, maybe I’ll try it. I expect my main hurdle will be stuff that isn’t in NicPkgs. Especially for dev stuff, I’m going to want to pull in low-profile GitHub stuff or Python packages. What’s the escape hatch to bring those into the dev environment?

> What’s the escape hatch to bring those into the dev environment?

The function `pkgs.runCommand` is useful if you just want to run some Bash commands https://nixos.org/manual/nixpkgs/stable/#trivial-builder-run...

The main difference compared to running commands in a normal terminal is that builds are sandboxed, with no network access by default:

- If your commands need to download some particular files, you can have Nix fetch them separately (e.g. using `fetchurl`, `fetchGit`, etc.) and provide them to your commands via env vars. See https://nixos.org/manual/nixpkgs/stable/#chap-pkgs-fetchers

- If you don't know what will be downloaded, or there's no way to run in an 'offline' mode, then you can specify hash for the result (making it a "fixed output derivation"). That will give it network access, and Nix will check that the output matches the given hash for reproducibility (you can just make up a random hash to start with; Nix will reject the result, telling you its hash, which you can copy/paste into the definition :) )

The reasons I like this approach include:

- Bash is familiar/traditional and mostly-compatible with e.g. official install instructions provided by many projects, Stack Overflow answers, blog posts and tutorials, etc.

- Powerful/unrestricted, in case we need to do some fiddling between some steps

- Nix often reveals problems with those familiar/traditional instructions; e.g. if some deeply-nested part of an installer happens to run Python, it will fail if Python wasn't explicitly listed in its dependencies (AKA `buildInputs`). Revealing and fixing such things up-front avoids the "works on my machine" problem.

- Bash commands are often tedious and inflexible; so after writing a few of these we may find ourselves wanting more structure, more reusable parts, etc. which is exactly what the helper functions in Nixpkgs provide (like `pkgs.stdenv.mkDerivation`, `pkgs.pythonPackages.buildPythonApplication`, etc.). In contrastt, starting off with those helper functions can seem overwhelming, and the benefits may be hard to appreciate immediately.

Re: 20 years of Nix

#36
post #19

Earlier quoted context omitted.

Hey! We've been working at Cachix to address this using https://devenv.sh/ . It's primary targeted to improve DX and on-board users quickly.

DevEnv looks neat, maybe I’ll try it. I expect my main hurdle will be stuff that isn’t in NicPkgs. Especially for dev stuff, I’m going to want to pull in low-profile GitHub stuff or Python packages. What’s the escape hatch to bring those into the dev environment?

For python, you could just install bare python with venv and/or poetry and manage your dev python dependencies outside nix. For eg. if you were using devenv.sh, there is an example here: https://github.com/cachix/devenv/tree/main/examples/python-p...

Re: 20 years of Nix

#37
post #4

I have been exploring nix for the past few months and my experience with nix has been both exhilarating and frustrating, simultaneously. On one hand, I find it hard to imagine not using nix now, but on the other hand, I hesitate to recommend it to other colleagues due to its steep learning curve, ux issues and potential for footguns. I sincerely hope that nix community improves the UX to make it more accessible to ne…

There are two sides to this problem, the first is to improve the UX, but the second is to clearly describe a compelling reason for people to adopt. It is very tempting to only blame the first, but I think we need to also need to tell a better story and highlight the values in a better way. This would then give people a reason to get past the UX issues in the hopes of achieving those desired values. For example; peopl…

Agreed, reproducibility is only one aspect of Nix and doesn't quite capture the whole picture. That's why so many newcomers see Nix as nothing more than a Docker replacement. There's also too much misconceptions about Nix the language that's scaring people off.

I'd like to see more being discussed about:

* Its unique ability to treat packages as programmable data (i.e., derivations)

* Its use case as a building block for deployment systems that knows about and integrates with packages

* Its JSON-like simplicity

They're all central to the Nix experience, and yet it's often overlooked in Nix discussions.

Re: 20 years of Nix

#38
post #4

I have been exploring nix for the past few months and my experience with nix has been both exhilarating and frustrating, simultaneously. On one hand, I find it hard to imagine not using nix now, but on the other hand, I hesitate to recommend it to other colleagues due to its steep learning curve, ux issues and potential for footguns. I sincerely hope that nix community improves the UX to make it more accessible to ne…

Hey! We've been working at Cachix to address this using https://devenv.sh/ . It's primary targeted to improve DX and on-board users quickly.

I think this project is really promising.

My main concern is that it puts another layer of abstraction atop an already complex (and at times leaky) abstraction.

I’d love to see more clear docs about what devenv is actually doing under the covers, and how to escape-hatch into Nix land when I inevitably need to tweak something.

Also, similarly, how do I map Nix docs (often just a set of example expressions) into equivalent devenv incantations?

(It’s been a few months since I last looked so maybe things have come along since then.)

Re: 20 years of Nix

#39
post #31

What happened to NixOps? It sounded like a great idea when I first read about it.

As far as I know, it’s still about [0]. I’ve had a better experience with deploy-rs though [1] - or even just using nixos-rebuild to target the remote machine.

[0] - https://github.com/NixOS/nixops

[1] - https://github.com/serokell/deploy-rs

Re: 20 years of Nix

#40
post #38

Earlier quoted context omitted.

Hey! We've been working at Cachix to address this using https://devenv.sh/ . It's primary targeted to improve DX and on-board users quickly.

I think this project is really promising. My main concern is that it puts another layer of abstraction atop an already complex (and at times leaky) abstraction. I’d love to see more clear docs about what devenv is actually doing under the covers, and how to escape-hatch into Nix land when I inevitably need to tweak something. Also, similarly, how do I map Nix docs (often just a set of example expressions) into equiva…

I think that's a valid concern. You read the nix pills and think you know what you're doing and then it turns out that the community has wrapped the things you've learned about in things you've never heard of, so you still can't learn from other people's repos.
Post reply on HN