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
lib: Add listFilesRecursive function to filesystem #101096
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not so sure about the name actually. Perhaps listFilesRecursively
?
a2aa7f5
to
42387c1
Compare
409150f
to
6a55ba0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roberth I'd say listFilesRecursive
(similar as mapAttrsRecursive
)
Add a friendly function to easily return a flattened list of files within a directory. This is useful if you want to easily iterate or concatSep the list of files all found within a directory. (i.e. when constructing Java's CLASSPATH) Style improvements Co-authored-by: Silvan Mosberger <github@infinisil.com>
ac7439b
to
5f1d1bc
Compare
@infinisil made the change :) |
Note that:
sounds likely to create accidental import from derivation. |
Can you elaborate ? Is it because the returned lists are PATH and not string ? |
No, it is because you can’t know what is in the result of a build before you build it, but the evaluation is a distinct phase before any building happens.
…On Tue, Oct 20, 2020, at 7:28 PM, Farid Zakaria wrote:
> Note that:
>> This is useful if you want to easily iterate or concatStringsSep the list offiles all found within a directory. (i.e. when constructing Java's CLASSPATH)
> sounds likely to create accidental import from derivation.
Can you elaborate ? Is it because the returned lists are PATH and not string ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#101096 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAASXLBCFURKPDJXLFJ2FWTSLYMIHANCNFSM4SWYGOPQ>.
|
Ah that sounds like what @roberth was commenting at in another PR of mine at #100660 (comment) I had the impression that if you had the outPath interpolated then it must have built. I guess Nix is smart enough to discern between simply referencing the /nix/store entry and reading it. Thank you for the clarification. |
I really don't like the It's also not clear that the API is very good. E.g. it takes a single BTW we're currently adding |
For filtering we can make it accept a |
I'm not sure if filtering is needed, because the expensive part of And the result can still be filtered with just the list |
For anyone curious about @grahamc feedback I wrote a little writeup on it https://fzakaria.com/2020/10/20/nix-parallelism-import-from-derivation.html @edolstra I had the same intention as @infinisil that the filtering can always happen afterwards on the full list. Happy to make any changes we land on. |
Motivation for this change
Add a friendly function to easily return a flattened list of files within a directory.
This is useful if you want to easily iterate or concatStringsSep the list of
files all found within a directory. (i.e. when constructing Java's CLASSPATH)
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)