Live data from Hacker News

What Is Nix?

engineering.shopify.com

261–270 of 344 posts

Re: What Is Nix?

#261
post #257
post #246

Earlier quoted context omitted.

It's necessary to hardcode paths in order to ensure that the exact version of a dependency is linked into the executable. Without this mechanism, nix packages would not be reproducible and self-contained. Also, the path isn't really hardcoded. You can use a custom path, but that means you can't use binary caches.

I'm sure there are reasons for it, but it still sucks. It ought to be possible to use binary caches and still swap out the path. (Modifying a string in an ELF executable isn't that hard.)

Modifying a string in ELF is hard. As long as the string has the same length as the original one, it has a good chance to work (but still fails for compressed data). But if you want an arbitrary directory, you need to replace it with a different length path, and that will probably break a lot of things.

Re: What Is Nix?

#262
post #257
post #246

Earlier quoted context omitted.

It's necessary to hardcode paths in order to ensure that the exact version of a dependency is linked into the executable. Without this mechanism, nix packages would not be reproducible and self-contained. Also, the path isn't really hardcoded. You can use a custom path, but that means you can't use binary caches.

I'm sure there are reasons for it, but it still sucks. It ought to be possible to use binary caches and still swap out the path. (Modifying a string in an ELF executable isn't that hard.)

The problem is how it affects all the hashes, which aren't recalculable in such an easy way.

Re: What Is Nix?

#263
I really wish nix was the solution, but I'm not sure it is. I currently don't install anything on my base system, but do it via docker. Looking through my dockerfiles, currently I have stuff installed via:

* apt

* apt preceded by apt-key add

* wget/curl

* pip & pip3

* git clone

* go get

* npm install

* snap

And that's even though I try to avoid esoteric package managers as much as possible. (For example, there was some package recently where the recommended method was brew for linux, and another that wanted to be installed via conda.

There's just so much stuff out there that insists on using some random packaging system. docker, even though it's a bit flaky, abstracts that away.

Re: What Is Nix?

#264
post #240

The only takeaway I get from this article is... Why is Nix? And from skimming along the comments, both on HN and on Disqus, there's a lot of confused people trying to understand/describe the difference between Nix and Docker, because although the article described how Nix works in a very technical way, it didn't explain what it can be actually used for.

It's a package manager written in such a way as to properly solve the problems with existing package managers which docker patches over. It uses deterministic builds and careful isolation of dependencies to ensure that the environment it creates is the same each time, and that you can have packages which depend on conflicting versions of another package installed at the same time.

The entire OS is accurately described by a config file, and this can be reproduced exactly using just that file.

In contrast to traditional package managers: handles conflicting dependencies, state is tracked through editing the config file, not a serial of install/uninstall commands which mutate the state of the system. Config files of installed packages are also controlled through nix config.

In constrast to docker: properly reproducable (Docker will re-run the same commands in the Dockerfile, but there's no guarantee you'll get the same result. For example, basically any package installation from a traditional package manager you run in the Dockerfile will not reproduce when run later because newer versions of packages will be installed), also more efficient in terms of space usage. However, AFAIK it does not namespace networking and so on (nixOS has its own containers system which does do this however).

Re: What Is Nix?

#265
post #56
post #31

Earlier quoted context omitted.

Burke Libbey has a few talks that are available on YouTube including a presentation at NixCon about the work he is doing at Shopify. I would highly recommend checking them out if you are interested in Nix.

Hi! Yes, and here's the link to my recent Nixology playlist: https://www.youtube.com/playlist?list=PLRGI9KQ3_HP_OFRG6R-p4...

Hey! At the end of your article you mentioned you're hiring. Are the positions remote? If yes, how can I get in touch?

Re: What Is Nix?

#266
post #209

Earlier quoted context omitted.

Yes that's true. But some things remain difficult, for example installing the latest version of CUDA. https://discourse.nixos.org/t/cuda-setup-on-nixos/1118/9

Yes, absolutely. Although to be fair, CUDA is a royal pain (although way easier) even on more standard distributions (supporting multiple versions seamlessly is hours and hours of fun and breaks all too easily) and is behind the great majority of time “wasted”. NVIDIA deserves a lot more flak for this than they receive.

Very true.

Part of the reason is probably that you need the proprietary drivers to use CUDA efficiently and as they are not in the (upstream) kernel you have to use some other tools, like unofficial repositories or the native installer (which doesn't always play well with the OS package manager, system upgrades, etc.). It's a real PITA.

Re: What Is Nix?

#267

Earlier quoted context omitted.

The downside is that the approach works best when packages are aware of the Nix approach. But the packages have not been written with Nix in mind, and some work is needed per package to adapt to the approach.

Nixpkgs has already done much of that work for you, thankfully.

It's a true wonder but much like the AUR (read: Archlinux User Repo), it's great 80% of the time when projects have reasonable popularity or committed (even 'niche') support.

It's honestly a treat for personal use if you have the mind of a tinkerer, but it's a difficult proposition to sustain in business (you basically end up vendoring yourself if big enough).

Nix has a very different proposition that solves from the "inside" a problem that is currently usually solved from the "outside" using e.g. Ansible in ops/infra, or Vagrant in dev.

In my perspective, the outside/black-box solution is ultimately brute-force, plain and simple. It works because it scales well, because copying data is cheap enough (re. deduplication, delta sync, etc) You hit limits when systems grow older and complexity creeps in no matter what however, it's an approach that requires a blank slate every now and then.

But the inside package approach is elegant in that it's absolute, it's not conjuring a black box that "should just work" if Ubuntu18.04-387lts-32-1.989-2a and my_fav_package.1.1.1.9.3.5-f work fine together, this time around. Sure, there is testing but we're back to the popularity/support limit.

In the end, in a world where some of the stack is basically nailed and can be modularized with clear forever-true expectations of I/O (the content, not the hardware), then Nix eventually prevails— but we really have to evolve "LTS" for what it means (like we'd do in construction, electricity, plumbing...), and not a half-trendy windmill / rat race. But we have to think of those systems that could transfer almost-as-is well from now to 2050 or more, not 2025-2030. It's not impossible, it's what COBOL did, does as we speak.

I think something like Nix could help shift perception in the right direction, but I expect mindsets to take a good part of the decade to change deeply, if it happens.

Re: What Is Nix?

#268

Earlier quoted context omitted.

As an example, what's minimally required to run two different versions of program-x from the command line. Can I do something like this easily? cat-8.22 /etc/passwd | cat-8.3 -A

Minimal example: export v824=$(nix-build 'channel:nixos-15.09-small' -A coreutils) export v830=$(nix-build 'channel:nixos-19.09-small' -A coreutils) $v824/bin/cat /etc/passwd | $v830/bin/cat -A You can get better specificity by using a nixpkgs git repo/hash instead of channel or adding `--no-out-link`, but this is minimal.

Even more concise:

nix run -f channel:nixos-19.03 hello -c hello | nix run -f channel:nixos-20.03 ripgrep -c rg Hello

Re: What Is Nix?

#270
Nix is a cool ecosystem but getting builds quite expensive on conventional CI/CD system. One can reduce costs by running custom Hydra CI instance but I would love it to be a bit better. Working with private stuff is a mess and requires deep knowledge of the system, hard for newcomers to pick up. Also, NixOps super cool extension to manage a fleet of instances.
Post reply on HN