Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtins.{path,filterSource} include all visited directories into output #4585

Open
kvtb opened this issue Feb 27, 2021 · 3 comments
Open

builtins.{path,filterSource} include all visited directories into output #4585

kvtb opened this issue Feb 27, 2021 · 3 comments

Comments

@kvtb
Copy link
Contributor

kvtb commented Feb 27, 2021

builtins.path and builtins.filterSource use a filter function which return boolean value.
If it returns true on a directory, the directory will be visited AND included into output
If it returns false on a directory, the directory will be NOT visited AND NOT included.

So a single bool is responsible for two actions.

There is no way to visit directory but exclude it from output.
Either builtins.filterSource (path: type: lib.hasSuffix ".java" path) ~/project
which do not visit directories
Or builtins.filterSource (path: type: type == "directory" || lib.hasSuffix ".java" path) ~/project
which includes all directory tree into produced output

There is nothing which work like find ~/project -type f -name '*.java'

@kvtb
Copy link
Contributor Author

kvtb commented Feb 27, 2021

related #885

@stale
Copy link

stale bot commented Aug 28, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Aug 28, 2021
@stale stale bot removed the stale label Dec 5, 2022
@stale stale bot added the stale label Jun 18, 2023
@infinisil
Copy link
Member

I developed a safer and easier-to-use abstraction for source filtering that should take care of this problem with a draft PR to Nixpkgs, please take a look! https://discourse.nixos.org/t/easy-source-filtering-with-file-sets/29117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants