Live data from Hacker News

Will Nix Overtake Docker?

blog.replit.com

91–100 of 259 posts

Re: Will Nix Overtake Docker?

#91
As TFA itself answers, "no". But I can give a different reason: nix is too much of a barrier of entry, relative to Docker.

Docker might not be simple; there's a lot of moving parts to manage, some hidden gotchas, and networks are a mess. But it's comparatively easy, and once you bake an image, it's pretty simple. Dockerfiles are basically just sh. Package managers are the usual suspects. Images are easy to distribute. It's very familiar.

Nix is not easy. It's a new syntax to learn, it's a new way of building, it's an entirely new way of thinking about the problem. But in the end, it does simplify packaging in the Rich Hickey sense of the easy/simple dichotomy. No braiding of packages and shared libs. But using Nix is not so simple. There's all kinds of bindings and bodges and bespoke shims to make it all work.

History tends to show that easy+non-simple things beat out simple+non-easy things (devs are lazy). Easy-kinda-simple vs non-easy-kinda-simple-but-long-term-gains? No contest in my opinion.

I think Nix is a beautiful idea but it's an uphill battle.

Re: Will Nix Overtake Docker?

#92
I only noticed recently that I have a tendency to search for reasons to use a tool. I literally googled "Do I need to learn Go?". You'd think it would work the other way around: I can't accomplish something with a language I use today, so I go searching for a language that solves my problem. Instead I'm literally looking for excuses to learn the most popular thing. It's absurd. (and really it's resume-driven development)

In terms of Nix versus Docker, they're completely different levels of abstraction and solve completely different problems. Docker is (among other things... it does a lot of things) an abstraction for reproducing network services on arbitrary platforms. Nix is an abstraction for installing and setting up files.

Re: Will Nix Overtake Docker?

#93
post #4

I've set up my new M1 MacBook Pro using Nix and it's been going relatively well. Home Manager manages global tooling like Neovim, random CLI tools, and config files while I've set up `default.nix` files to use with `nix-shell` per-project. The set up of each project can be a little tedious as I still find the language confusing but once everything is set up the reliable re-creation is excellent. I love the feeling of…

I recommend also using direnv, with nix-direnv (home-manager has a setting to trivially enable nix-direnv). This lets you integrate your shell.nix environment into your existing shell without having to run `nix-shell` or use bash.

Oh wow, this is fantastic! Thanks for the tip and I'd like to thank you for all of the work you do on nix + Darwin. I'm using your `nix-env.fish` package and it's made things much easier than when I tried this setup a few years ago.

Re: Will Nix Overtake Docker?

#94
post #31

Earlier quoted context omitted.

Funny, because I feel that simple tasks that would take minutes in my machine are now a dev adventure with docker. And I mean funny. I suspect it is different mindsets. And I personally like that both seem to be thriving.

I feel similarly with Docker. But it's easier to explain to newer folks because it's only a single layer of abstraction above shell commands.

I really wish something like singularity containers had taken over -- that was literally just shell commands.

Re: Will Nix Overtake Docker?

#95
post #50

Earlier quoted context omitted.

> There's a blog post that goes around from time to time about how a company have three risk tokens to allocate per project on non-boring technologies. https://mcfunley.com/choose-boring-technology

Thanks, this is the one! Highly recommend it, especially when you're in the HN echo chamber of new and interesting technologies

See also: http://boringtechnology.club/

Re: Will Nix Overtake Docker?

#96
post #31

Earlier quoted context omitted.

Funny, because I feel that simple tasks that would take minutes in my machine are now a dev adventure with docker. And I mean funny. I suspect it is different mindsets. And I personally like that both seem to be thriving.

I feel similarly with Docker. But it's easier to explain to newer folks because it's only a single layer of abstraction above shell commands.

I call this. It isn't a single abstraction over shell. It is a single closure over shell. And that is surprisingly hard to explain.

Again, though, I am glad both are thriving. Competition of implementation is... not that compelling to me. Competition of approach, is amazing.

Re: Will Nix Overtake Docker?

#97
post #4

I've set up my new M1 MacBook Pro using Nix and it's been going relatively well. Home Manager manages global tooling like Neovim, random CLI tools, and config files while I've set up `default.nix` files to use with `nix-shell` per-project. The set up of each project can be a little tedious as I still find the language confusing but once everything is set up the reliable re-creation is excellent. I love the feeling of…

I have a Makefile that I use when I need to spin up a new laptop [1]. For your description it sounds like it is functionally similar. What does nix bring that a Makefile like this one doesn’t?

[1] https://github.com/jchilders/dotfiles/blob/main/Makefile

Re: Will Nix Overtake Docker?

#98

IMO initial value of docker for local development is enabling me to run two copies of postgres without them shitting on each other. I get that nix is supposed to be hermetic, but does it enable two of something? nix being really good at package management is something docker needs to imitate -- out of order apt-get without requiring a re-downloading all the packages, for example, seems like it would shrink most cloud…

> I get that nix is supposed to be hermetic, but does it enable two of something?

No, it doesn't solve the TCP port isolation problem. (But Docker doesn't really either. Linux network namespaces should, but nobody bothered to develop tools for that yet.)

Re: Will Nix Overtake Docker?

#99

Earlier quoted context omitted.

Yes, and Nix can still lose on maintainability in the long run, considering it is more difficult to onboard new devs with it. They have to learn the Nix expression language and write custom bindings for much software instead of calling the native package manager inside Docker.

I don't understand how these are comparable. I also don't understand what you mean by "bindings". Do you mean writing nix derivations for new packages? I would much rather do that than fiddle with Debian packaging. Or do you mean writing nix modules to configure a service? There are certainly some (IMO) over engineered nixos modules, but there are also some dead simple ones.

> I don't understand how these are comparable

They fulfill similar business functions - allowing you to run the same code on a bunch of dev machines and on prod (modulo modifications for e.g. database storage in Docker's case). Nix people get hung up on the fact that Docker runs containers, but it doesn't really matter that much. Often Docker is the shortest path to getting software running on multiple machines reproducibly.

> I also don't understand what you mean by "bindings"

I am referring to derivations and modules. Both are glue that you have to write for existing software that is already packaged. With Docker you leverage the existing packaging ecosystem like pip or apt. The packages are already written for you, and you can follow the installation instructions from a project repository and they translate seamlessly into Docker.

For example with ML & Python - If you want PyTorch with CUDA support, you can follow the official documentation [0] and basically copy and paste the installation instructions to a Dockerfile RUN statements. If anything breaks you can file an issue on the PyTorch issue tracker which has a wide audience. With Nix you have to write glue on top of the installation yourself, or a maintainer does it with a much smaller code review and support audience. Sometimes the audience is just the author, given that Nix project people commit directly to master frequently and do self-merges of PRs [1]. And there are other hurdles like compiling Python C extensions, which are pervasive.

Another example is with software systems, I guess this would be a Nix module. Here's GitLab: [2] where it was really difficult to translate the services into Nix. But a lot of company internal services can look like GitLab with a mix-mash of odd dependencies and languages. And writing a Dockerfile for this is much easier than Nix, since you can copy from the existing README specifying the Debian or language-specific dependencies. (edit: and if there are conflicts between dependencies of the services they can go into different containers. Getting the benefit of Nix - reproducibility - without the extra effort.)

[0]: https://pytorch.org/get-started/locally/

[1]: https://discourse.nixos.org/t/proposal-require-pr-authors-to...

[2]: https://news.ycombinator.com/item?id=14717852

Re: Will Nix Overtake Docker?

#100
post #97
post #4

I've set up my new M1 MacBook Pro using Nix and it's been going relatively well. Home Manager manages global tooling like Neovim, random CLI tools, and config files while I've set up `default.nix` files to use with `nix-shell` per-project. The set up of each project can be a little tedious as I still find the language confusing but once everything is set up the reliable re-creation is excellent. I love the feeling of…

I have a Makefile that I use when I need to spin up a new laptop [1]. For your description it sounds like it is functionally similar. What does nix bring that a Makefile like this one doesn’t? [1] https://github.com/jchilders/dotfiles/blob/main/Makefile

I guess it's reproducible - creates a system that has exactly the same versions of all programs and all libraries.
Post reply on HN