dramforever/nix-dram

use a list of flakes to build flat package namespace

Opened this issue · 2 comments

nrdxp commented

One of the biggest objections to this patchset so far has been that some don't want to privilege any given flake over the others. I realized we might resolve this by allowing for more than one flake to combine their package outputs together into a flat package space for nix to search.

We could even set the default to add all the registry flakes together into a flat package space. This could be done by building on your work in #9 and simply extending it to accept multiple flakes.

I'm just not yet sure how much this would increase the complexity of the implementation.

and simply extending it to accept multiple flakes

'Simply'...

To be fair though, from a user's perspective it does seem to be a simple way to use multiple flake with a single installable.

The main thing that will be a problem is that it's going to sometimes download a large number of flakes and evaluate them just to find where one installable is.

Another problem is that attributes will invariably clash. For packages it's less of a problem, but there are things like lib and devShell. If we're going to create different cases for different command that's going to be some work.

I don't think this will work with the entire registry plus user defined entries. If it's just those specified by the user in default-flakes though it might work.

From a source code perspective, I think I'll just create a subclass of Installable based on InstallableFlake, probably call it InstallableFlakeMulti. It will search the attribute in a list of specified flakes in order and find the first match. Some sort of variation on InstallableFlake::toValue()