Friday hackday project: nix-filter

I know there are already a lot of nix source filters out there, but bear with me.

  • the various .gitignore source filters are not good enough! In monorepos, I only want to add what I need and not rebuild the world otherwise.
  • lib.cleanSource: the MVP of filters but clearly not powerful enough.
  • lib also has some source filters but I find them confusing to use.

So his is a different attempt. It’s a very small and self-contained project. If successful, I think it should be added to the nixpkgs/lib.

Please have a look, and give me feedback!


Looks nice! Does it rebuild when the root folder of the source is renamed?


It shouldn’t rebuild since the derivation name defaults to “source” in either case and the content would be the same.