hercules-ci / flake-parts

❄️ Simplify Nix Flakes with the module system
https://flake.parts
MIT License
721 stars 41 forks source link

Add nixpkgs module (fix #74) #147

Closed Atry closed 3 months ago

roberth commented 1 year ago

I think this is an interesting idea, but not quite sustainable, and not quite appropriate for the flake-parts core architecture; although feel free to use this module or pattern freely until we have a better solution.

The right approach I think is to make an RFC 78-style implementation of this module in upstream nixpkgs, so that it is well-tested there and can be safely reused in any application (not even just flake-parts). Without such a framework, this will inevitably lead to something breaking, unproductive discussions back and forth ("why should nixpkgs care? etc"), without working towards a more broadly applicable solution to RFC 78.

roberth commented 3 months ago

Although I like the sort of elegance of such a short solution, I don't think we should be making the module list of perSystem strict in a Nixpkgs input.

For instance, when a flake exports an overlay with easyOverlay, pkgs will be set to the overlay final parameter, and it would be bad to have to fetch an unused Nixpkgs just to load its entrypoint module, and then find out that the only effect of that module is going to be overridden anyway.

So architecturally, it should look more like #137, except perhaps a simpler implementation.