Live data from Hacker News

What Is Nix?

engineering.shopify.com

171–180 of 344 posts

Re: What Is Nix?

#171
post #129

This article is a good explanation of how nix works at a high level, and I'm excited to see nix getting some really prominent support, but for some reason it never tells you what the point of all of this is, so I think many folks might feel turned off by it. In other words, I don't believe it ever compellingly answers the question that constitutes its title. The word "package" doesn't even appear until near the end o…

The PhD thesis that goes with Nix is a really great intro to it. It's very accessible and well-structured. It motivates the need for a new take on package management by analogy to memory management in programming languages. It contrasts how software deployment works today (“Fuck it, I’m sure /usr/bin/local/python is a reference to a python 2.7.12 install with PIL available”) to how we used to write software (“Fuck it…

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.

Re: What Is Nix?

#172
post #144

Really it's kind of a minimalist linux distro with the capacity to coexist harmonically and/or parasitically with another operating system. Don't try to say 'oh it's like arch' or 'yeah it's a bit like Ubuntu', because no, it isn't, and by design. It seems that as much as design meant to go a particular way, there it went. It does pretty well directly on the hardware, but seems to want to live (like it is) in a conta…

> It has a certain otaku appeal and ninjatsu stealth. I'll probably like it a lot some day soon but at the moment it just screams 'exotic' in my ears while I'm asleep at night. I’m trying to refute this characterization, but I am sitting in front of my desktop with an anime background in SwayWM on NixOS. Is there something I don’t know about correlations between seemingly unrelated hobbies?

NixOS, Emacs, Haskell, tiling window managers.

They're a clique in the tech world. I think a unifying theme is to have a small foundation that the user can develop within.

Going a bit further on my soapbox, you might also be into philosophy, anime, election reform, baduk, and math. Is the underlying personality trait systemizing/stubbornness, wanting to break everything down, and rebuild it according to defined principles?

http://dreamsongs.com/RiseOfWorseIsBetter.html would call this approach the MIT style of design.

@nntaleb might suggest they overestimate their principles and their ability to enact their principles, and call them IYIs. :)

(This comment itself is my admission of being an IYI.)

Re: What Is Nix?

#174

Earlier quoted context omitted.

Oh dear... so you have to write a Nix package (and learn how the language and package management work) just to modify global config files, instead of just editing them? That sounds like an absolute nightmare for a local machine, though possibly a great tool for automated systems. Also, if there's no /nix/etc... then what is Nix modifying? sshd (or any other more common program; I'm just using sshd as an example to un…

Interestingly, sshd WILL magically know to look at /nix/store/efgh5678-my-sshd-config-2.0/etc/ssh_config. Usually you would use sshd as a systemd service (possible to do and manage with Nix in Ubuntu, but why would you?). If so, you would write the systemd configuration using Nix and the service file deployed to NixOS (or Ubuntu, imagine deploying some custom/proprietary service you want isolated from whatever else t…

Interesting, thank you! So that means programs are sometimes patched to look for configs in nonstandard locations generated by Nix during installation time. But then if I wish to change any of those configs (maybe to change one of the defaults)... I have to copy them, make my modifications, generate my own package for them, and install them to wire them in as substitutes for the existing packages. Then when the upstream package changes the config file, I have to generate a new package with all the conflicts manually resolved, right? It seems a bit of an arduous process, though I do see the appeal.

Re: What Is Nix?

#175
post #20
post #2

I'm still confused. What is Nix? Is it an OS, or a package manager? From the looks of it it's a package manager that I should be able to use it on any POSIX system, but I doubt that's the case?

It's kind of a mess. Nix is a collection of tools and systems that together form a highly reproducible build system. Nix is also a declarative, largely pure and lazy programming language that you use to design and specify the different build outputs for the Nix build system. Nixpkgs is, more or less, the only project written using Nix (and a lot of shell). It's a collection of many thousands of "derivations", many of…

"Nix is a collection of tools and systems that together form a highly reproducible build system."

Wouldn't it have been nice to have that statement at the start of the article?

Re: What Is Nix?

#176
post #82

Earlier quoted context omitted.

Ah yes.. cryptocurrency, where bizarre programming practices secure large sums of money

LOL. Reading that audit report made me immediately wonder who in the heck is blowing money on bringing new tech to their critical finance systems. And then I saw your post and, yes, that answers that.

I am aware of a few trading firms that are phasing in nix to handle their dependency clusterfucks.

Re: What Is Nix?

#177

Earlier quoted context omitted.

Isn’t that the same goal as Docker? I’m surprised there’s still no Docker base image for NixOS...

"Same execution environment everywhere" is one way which developers use Docker. Docker gets this by copying the layers of a built image. Unlike nix, the image building itself doesn't need to be reproducible. So you can have a Dockerfile which works now but will fail to build in however many months. "Reproducible builds" do get you "same execution environment everywhere". But they have the stronger guarantee that for…

I do have to commend Docker for providing and managing an agreed upon VM for non-Linux users to host all their containers. It's the "killer-feature" that has made it as successful as it is. But underneath it requires a VM (libcontainer,LXC,virtualbox,hyperkit,etc) on non-Linux machines.

This helps developers work together and quickly get small projects up and running. I'd contend that after a while, a mess of containers/sidecars ends up becoming just as difficult to manage as a mess of native binaries. Hence the growth of so many container management systems. Now, because they are re-inventions of service managers we get the benefit of designing them from scratch for modern needs, but also loose many of the benefits of well understood semantics of native processes.

Looking for feedback: I've been playing with an idea (and have a system in production using it to try out the concept) where the Dockerfile only contains busybox+nix and you when you run it you specify an environment as a Nix path. Specify a binary cache via env vars. Using "nix run" this will download all deps and run your program, with bind mounts all containers can share the host cache. Put a RUN into the Dockerfile and you can prefetch all the deps. Basically it's a Docker container that uses Nix at build or run time for all the heavy lifting, instead of the docker layers mechanism.

Re: What Is Nix?

#178
This sounds similar to BuildXL[1] (originally called Domino) which Microsoft uses to build Windows has been in use 6 years. It does this sandboxing using Detours on Windows which intercepts system calls and allows you to described packages in a language called DScript. I think you need something like this if you don't use a system like Bazel that keeps build dependencies well isolated. Even then the system you use can leak into the build.

1. https://github.com/microsoft/BuildXL

Re: What Is Nix?

#179
post #120

I loathe to be so critical, but I have no idea what this is. I'm sorry to say but this is a bad article - either that - or nix itself is a mishmash of things impossible to explain. I just see red flags everywhere. If it's 'A' - then maybe take some time to do a high-level introduction and some context. - 'Everything depends on something else' - really? Most 'installed software' doesn't depend on a whole lot else. Doe…

> Most 'installed software' doesn't depend on a whole lot else.

Try this: Pick some random binaries on your system and run 'ldd' on them.

Re: What Is Nix?

#180
post #129

This article is a good explanation of how nix works at a high level, and I'm excited to see nix getting some really prominent support, but for some reason it never tells you what the point of all of this is, so I think many folks might feel turned off by it. In other words, I don't believe it ever compellingly answers the question that constitutes its title. The word "package" doesn't even appear until near the end o…

Isn’t that the same goal as Docker? I’m surprised there’s still no Docker base image for NixOS...

There's some conceptual overlap but I don't think the two tools are redundant.

Using nix for development is sort of like having dedicated handcrafted development Docker containers for every single project... without having to ever use Docker or containers. You just get the sandboxing and safe reproducibility for free. It's kind of like having a build tool like cargo or stack, but for everything, all the time. You can fire up nix-shell for a project and just magically have the dependencies for that project available. There are tools like direnv and lorri that make this even easier and more powerful. Then, if you want to package up your project into a Docker image for deployment, you get that for free too.

With all of that said, the magic is blunted a bit by some rough edges, missing packages here and there, etc. I wouldn't jump into nix expecting to have a completely polished and flawless experience like you can get with Docker, which is a much more mainstream project at this point. But I do think this will rapidly improve with nix, especially with large and well-known companies like Shopify using it.

Post reply on HN