dream2nix icon indicating copy to clipboard operation
dream2nix copied to clipboard

Add a heretic packaging module

Open DavHau opened this issue 2 years ago • 0 comments

Add support for heretic package management to dream2nix.

Motivation

Allowing tradeoffs is often better than pushing users against purity walls, where it becomes intensely hard to package things. Often it's a reasonable tradeoff to just relax the sandbox by using __noChroot = true and simply let that tool wanting to download chromium from the web do its thing.

This is specifically important to onboard new users effectively. The nix ecosystem needs support for gradual adoption of nix, where the amount of stuff controlled by nix is low at the start and increases over time, allowing users to get started with minimal effort, while accepting some impurities, then climbing up the purity ladder step by step, if desired.

The motivation and an example implementation behind this is described by @zimbatm's blog post Nix packaging, the heretic way

It's also worthwhile watching @grahamc's talk Good Enough at NixCon 2022 emphasizing the value of supporting certain tradeoffs.

Implementation

__noChroot = true basically makes a nix build behave similar to a Dockerfile build, where the build instructions can be impure, eg. fetch random stuff from the internet. This decreases reproducibility during build time, but results can still be distributed reproducibly through a shared cache, similar how docker deployments gain their reproducibility from artifact sharing through docker hub etc.

This could be integrated into dream2nix by adding language specific modules that make use of the heretic style, for example nodejs-npm-heretic or python-pip-heretic.

For a kick start, the npm build logic from @zimbatm's blog post could be used and put inside a new dream2nix module.

Getting started

If you want to have a look a this, but feel unsure of how to get started, feel free to ask me anything.

DavHau avatar Oct 15 '23 14:10 DavHau