Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why would you recommend nix/flakes over Docker?


There are lots of advantages and disadvantages to both, and use cases where one or the other shines. A proper response would probably be a blog post in length, but in brief, I find that Nix really makes everything explicit. You can see the source code and it reflects everything that went into a build; you can also control every bit of it. It is, however, consequently generally more verbose, and also requires a bit more learning. Nix also tends to compose much more cleanly than docker.

Maybe an analogy: nix is a package-lock.json. Docker is a package.json (with no version bounds) and a node_modules directory. You can just copy that node_modules directory around so everyone has the same setup, but it's much harder to introspect than a lock file, and the way you go about updating it is deleting the folder and rebuilding everything - no fine-grained control over one specific dependency.


> You can see the source code and it reflects everything that went into a build

There's no "FROM ...." for Nix like there is for a Dockerfile?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: