Is lib.cleanSourceWith the best way to get all markdown files in a directory?

…or is there some more idiomatic way to do this?

I’ve tried pkgs.lib.sourceByRegex /path [ "^.*\.md$" ], but it only seems to copy the top-level Markdown files in path to the /nix/store instead of all Markdown files in subdirectories.

Is this something I’ll have to write from scratch using readDir and company?

You might want to have a look at

1 Like

You might want to have a look at

Thanks for the recommendation. AFAICT it looks like this behaves similarly to lib.sourceByRegex where it only includes the top-level Markdown files.

I left a comment on an open issue with nix-filter. Let’s see how that pans-out:

Are you looking for lib.sourceFilesBySuffices?


Are you looking for lib.sourceFilesBySuffices ?

That’s recursive, but it includes a bunch of garbage empty directories in the output too.

1 Like

I reported the bug: