Seems like this would benefit a lot from the changes in source combinators: extend, trace, cutAt, focusAt and more by roberth · Pull Request #112083 · NixOS/nixpkgs · GitHub. It would simplify your implementation and make the functionality composable and interoperable (among other improvements).
Personally I don’t like that include
and exclude
are parameters to the same function. This means that as a user, I can not decide which one is more important than the other, and perhaps worse is that I can’t see it at a glance when reading it. That’s why I’ve proposed a union-like function sources.extend
in #112083. It allows you to express both choices through composition with sources.filter
.
It’s interesting that my PR is four months older than your project. Goes to show that there’s a need for [RFC 0082] lib.experimental by fare · Pull Request #82 · NixOS/rfcs · GitHub. I’ve nominated myself as shepherd. Is anyone else interested?