News for hackers. Stuff that matters.
Re:Nix as OS X Package Manager by benley on Wednesday May 25, 2016 @06:18PM (#11773591)
The big difference is that nothing about Dockerfiles implies that the processes they perform to build an image are deterministic or repeatable. Will a build step that runs `curl https://github.com/something/whatever` do the same thing in six months that it does today? Docker doesn't help with that at all. Nix improves determinism by (almost) guaranteeing that if you build the same nix expression six months from now, you'll get exactly the same dependencies, all the way down to glibc. Either that or the build will just fail, if remote dependencies aren't downloadable anymore, which is always tons of fun.
Re:Nix as OS X Package Manager by thejosh on Wednesday May 25, 2016 @07:58PM (#11774149)
YES.

Finally someone understands what really annoys me when I say that docker isn't 100% reproducible if you aren't using version pinning or something similar.

If you have 2 developers, and one of them does a build the next day, you could have them with two different versions of a package when the version went up.

Re:Nix as OS X Package Manager by koverstreet on Thursday May 26, 2016 @12:14AM (#11775360)
That isn't even the bad part - the bad part is that give some big complicated docker image (or any build in general!), you really have no practical way of knowing what's different.

That should scare people.

Re:Nix as OS X Package Manager by mgkimsal on Thursday May 26, 2016 @12:15AM (#11775369)
sounds like 'emerge hell' from gentoo 12 years ago.
Re:Nix as OS X Package Manager by wmertens on Thursday May 26, 2016 @09:27AM (#11777711)
Ex-Gentoo dev here. It is not the same. Gentoo emerge runs in place, and you can definitely break your system with a broken build.

NixOS on the other hand, builds everything in sandboxes that only expose the requested dependencies. Builds are almost 100% deterministic. The cherry on top is that your system installation is simply a package consisting of all other packages and configuration symlinked together, and you replace your entire system in one go (atomically, by writing a symlink).

If the build fails at any point along the chain, you get an error and your system remains unchanged. You can totally switch from one major release to the next (and back) without hassle.

Re:Nix as OS X Package Manager by mgkimsal on Thursday May 26, 2016 @10:26AM (#11778164)
the non-deterministic nature is what I was getting at.

I worked at a place where they'd spin up a new gentoo box for a dev with stock "emerge foo" and let everything run up.

Then 3 weeks later, they'd do it again for the next dev, and they'd have many diff versions.

I know they weren't "doing it right", but they were doing it the default way they learned, and it caused a lot of problems.

Thanks for the info/clarification though.

Re:Nix as OS X Package Manager by darkarmani on Wednesday June 01, 2016 @09:38AM (#11814207)
It's been a LONG time, but when you build gentoo packages you can save the builds, right? Then if you bring up identical servers, you can just install from precompiled packages.
Re:Nix as OS X Package Manager by girvo on Wednesday May 25, 2016 @08:27PM (#11774271)
You're not wrong, but Docker comes at it from a different angle; Docker expects you to be handing around tagged images, to solve a similar set (but not the same set!) of problems that reproducible builds solve.

Ideally, I want _both_ of them: tagged Docker images being sent between environments (with `docker run -e SOME_ENV=testing imagename` for changing the internal config), but reproducible builds in my Dockerfile. I wonder if Nix can be used to achieve that last part?

Re:Nix as OS X Package Manager by xyzzy_plugh on Wednesday May 25, 2016 @08:54PM (#11774407)
The problem is tagged images are fundamentally broken. If I can't reproduce, bit-for-bit, what is in the tag, how can I vouch for the tag?

Images are nothing but a caching technique for the results of deterministic builds.

If you're using them for any other reason, you have a flawed process that is going to come back to bite you some day.

Re:Nix as OS X Package Manager by ecnahc515 on Thursday May 26, 2016 @12:51AM (#11775539)
You solve it by signing the image. Sometimes you just won't be able to get a completely reproducible build processes that's fully deterministic, so Nix cannot fix this problem entirely. Additionally, sometimes you just don't have time, or experience to take another program/tool you didn't write and package it up such that it never downloads things from the internet.

It's a hard problem to solve, and Nix helps a lot, but it's not going to fix all the problems, which is why we should care more about trusting the packager to package something relatively reproducible and sign it so that we it can be vouched for.

Re:Nix as OS X Package Manager by ramblenode on Wednesday May 25, 2016 @08:52PM (#11774393)
Yes, you can do this. There is a utility "nix-docker" that will convert a Nix configuration file into a BusyBox Docker image (see e.g. http://zef.me/blog/6049/nix-docker)
Re:Nix as OS X Package Manager by rokgarbas on Friday May 27, 2016 @05:21AM (#11784824)
with nix you can now build docker images ... docs are in the manual http://nixos.org/nixpkgs/manual/#sec-pkgs-dockerTools

and it is actually rather cool since you don't rely on any docker command :)

Re:Nix as OS X Package Manager by mateuszf on Thursday May 26, 2016 @05:23PM (#11781747)
Unfortunately the repo says:

> DISCLAIMER: This project is no longer actively maintained and probably broken

Re:Nix as OS X Package Manager by girvo on Thursday May 26, 2016 @02:23AM (#11775977)
Oh brilliant! Thanks for that, definitely going to give that a shot :)
Re:Nix as OS X Package Manager by pacala on Wednesday May 25, 2016 @06:33PM (#11773682)
In practice, one can check the Dockerfile lineage of a given Docker image and assess the quality of the commands. Good practices are to use package managers with explicit versions, for example "apt-get install subversion-tools=1.3.2-5~bpo1". Or, if you so desire, just pipe NixOS outputs into Docker, as somebody else in this thread mentioned.