Live data from Hacker News

Will Nix Overtake Docker?

blog.replit.com

121–130 of 259 posts

Re: Will Nix Overtake Docker?

#121
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

Not an answer to you're question, but do you feel safe doing (https://github.com/jchilders/dotfiles/blob/main/Makefile#L34)

> sudo curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/in... | /bin/bash

piping the output of a curl command to sh without first checking the sha256 of the file you just got?

In a similar situation I would not be comfortable without at least getting a specific version of the tool I'm downloading and then hardcoding an hash of its content I computed after manually downloading and inspecting its content.

Re: Will Nix Overtake Docker?

#122

Earlier quoted context omitted.

Is it? Or is it just a tool that requires a different mindset so those coming to it from another regular distro? If the latter, then I’m not sure it’s something they will see as a problem but more its very ethos.

Maybe an apt comparison is git. It's just as easy to make a mistake with git today as it was however many years ago; git hasn't fundamentally changed in ways that make it easier. Git still more/less requires you to have a good understanding of what's going on in order to be comfortable using it. But, since use of git is now widespread, it's less of an issue. And the git CLI has seen some UX improvements. Nix is very…

> It's just as easy to make a mistake with git today as it was however many years ago;

Pro tip from an actual pro :

git became significantly easier for me once I decided

1. to just use a good comfortable gui (at least one tui also look good) for anything beyond commit and push. (maybe not everything can be done from your gui of choice but at least you get a good overview of the situation before you dive in with the cli.)

2. and to just stick to the basics. (And when you need to help someone else who didn't, take it carefully even if that means you don't look like a wizard.)

In fact even working on the command line feels easier once I had worked in a good gui for a while.

Don't believe experts who claim that you need to study vim and stick to the git cli to "get it".

But of course: if cli is your thing, use it, just stop writing blog posts that claiming it is the only true way.

Re: Will Nix Overtake Docker?

#123

I used Docker Compose to, among other things, manage Postgres, which wants to listen to port 5432 and use a central dir to hold databases. Can a non Docker solution allow me to run multiple instances of Postgres?

Without going into stuff like Kubernetes, basically what you want is to run your postgres instances behind a load-balancer listening to 5432 and forwarding to whatever instance. The most common with postgres is probably HAProxy.

If your problem is that you want to run unrelated instance of postgres... you don't really have a problem to begin with. Either use docker run to run your postgres image on different ports with different volumes, or just make a docker-compose YAML file with a bunch of postgres services. It's not like you have to have a single one.

Re: Will Nix Overtake Docker?

#124
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.

The issue with simple solutions is that the underlying problem still has the same complexity. This complexity rises up sooner or later and depending on your abstraction will be nice caught within it or make a complete mess.

Re: Will Nix Overtake Docker?

#125

Earlier quoted context omitted.

Those sound like issues with your Docker usage - there are options to keep base image quite streamlined (e.g. alpine or distroless images).

For context, I'm referencing our (legacy) base image for projects on Replit: Polygott ( https://github.com/replit/polygott/ ). The image contains dependencies needed for 50+ languages. This means repls by default are packed with lots of commonly used tools. However, the image is massive, takes a long time to build, and is difficult to deploy. Unfortunately, slimming the image down is not really an option: people rely…

> For context, I'm referencing our (legacy) base image for projects on Replit: Polygott (https://github.com/replit/polygott/).

May I ask why you didn't use something like Ansible to build such a complex image? With appropriate package version pinning (which it's the real crux here) it should work well enough to get a reproducible build.

I understand it would already have been something different from a pure Dockerfile so it's not that fair to compare buuut...

Re: Will Nix Overtake Docker?

#128

I think people are missing the forest for the trees with this. In my view, the reason Docker has all the hype is because I can look at a Dockerfile, and know what's up. In seconds. Sometimes in milliseconds. It's a user experience thing. Yes, Nix is better for 'technical people that spent the time learning the tool', but Dockerfiles rely almost entirely on existing System knowledge. Yes, Nix is 'better', but the fact…

Lots of people seem to be building containers with non-Dockerfile based things though, especially in the JVM world.

You mean through maven configuration? At the end of the day it is still a dockerfile but constructed using Maven's xml.

I hate it haha

Re: Will Nix Overtake Docker?

#129

Earlier quoted context omitted.

>Build times in Haskell were bad enough this one's very true. Every time I try to build something in Haskell on my laptop it feels like we're moving closer to the heat death of the universe. Is there some good read on how/why Haskell compilation times are so long compared to some other languages?

> moving closer to the heat death of the universe So… you're saying your laptop is super cool? Because the heat death of the universe is when thermodynamic energy is equally distributed everywhere, which, given the large space of the universe, means really cold.

Actually, the heat death is when all potential energy in the universe has been converted to heat. So converting an excess of stored chemical energy in their laptop battery to heat by compiling a load of Haskell would be a fine way of increasing the entropy of the Universe. Thus moving ever so slightly closer to the inevitable heat death.

Re: Will Nix Overtake Docker?

#130
Eventually? It is possible. You could probably make a thin wrapper to convert basic Dockerfiles into a native Nix system configuration. But running Docker images on Nix is easy and making Docker images from Nix is pretty easy so there really isn't a need to get rid of the Dockerfile itself.

Also given that a blog post posted today is already sort-of out of date [1] when it comes to Nix, it is going to take a while. (Not that it really matters for the context of this blog post).

[1] Despite being an 'experimental' feature, the future of Nix is Flakes which are most simply a function definition (inputs & outputs) with the inputs pinned via hashes.

Post reply on HN