…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 https://github.com/numtide/nix-filter
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: https://github.com/numtide/nix-filter/issues/9#issuecomment-1194179705
Are you looking for
lib.sourceFilesBySuffices
?
That’s recursive, but it includes a bunch of garbage empty directories in the output too.