Hacker News new | ask | show | jobs
by ki_ 1203 days ago
I like nix because it seems like an alternative to docker. Yet. Im never going to use it, because it has complexity and i dont understand why. Which is why i dont use docker nor nix. I can work with both, i just dont want to waste my time on them unless i have no other option.
1 comments

It's not a Docker alternative, they are very different. There's some overlap in the sense that you can package an app using both. But that would be like saying APT is a Docker alternative.

Docker (and containers in general) will provide filesystem, process and network isolation. Your process can pretend it has the whole machine for itself (and even a different linux distribution) even though it's not true.

A Nix package will not do any of that. The package manager solves the problem of managing application packages, versioning, and dependencies; and doing so in a way that's 'immutable'. There's some filesystem abstraction (specially if you use nix-shell) so you can pretend that a particular version is the only one that's installed in the machine, or that a package is installed when it's not.

There's complexity but there's a reason for that.

> It's not a Docker alternative, they are very different. There's some overlap in the sense that you can package an app using both. But that would be like saying APT is a Docker alternative.

They do share one use case: run software without having to install it.

I think Docker mostly is about running services in an isolated manner, and is easy to distribute (because its images will run the same way in each host). -- But, I do see some CLI tools provide a docker container, too.

Nix, with its flakes, supports a `nix run` command which is very similar to `docker run` (if you're thinking of "run without installing" rather than "process / network isolation"). -- In that sense, it is like 'Docker, but without containers'.

e.g. you can run `nix run nixpkgs#helix` and try out helix, or even `github:helix-editor/helix` to build & run helix from its source.