Skip to content

Comments

lib.fileset.fileFilter: init#260265

Merged
roberth merged 1 commit intoNixOS:masterfrom
tweag:fileset.fileFilter
Oct 24, 2023
Merged

lib.fileset.fileFilter: init#260265
roberth merged 1 commit intoNixOS:masterfrom
tweag:fileset.fileFilter

Conversation

@infinisil
Copy link
Member

Description of changes

This is another split off from the WIP fileset combinators PR.

This adds one function:

  • lib.fileset.fileFilter :: (Attrs -> Bool) -> FileSet -> FileSet
    Filter the files from a file set based on a predicate function:
    # Includes all regular default.nix files from the current directory
    fileFilter (file: file.name == "default.nix" && file.type == "regular") ./.

This work is sponsored by Antithesis

Things done

  • Docs
  • Tests

@github-actions github-actions bot added the 6.topic: lib The Nixpkgs function library label Oct 10, 2023
@infinisil infinisil changed the title lib.fileset.fileFilter: init lib.fileset.fileFilter: init Oct 10, 2023
@infinisil infinisil mentioned this pull request Oct 10, 2023
7 tasks
@infinisil infinisil force-pushed the fileset.fileFilter branch 2 times, most recently from 377fbd3 to 43f5dc3 Compare October 10, 2023 17:30
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Oct 10, 2023
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, nice one!

[b]=1
[c/a]=1
)
# Note that union evaluates the first argument first if necessary, that's why we can use ./c/a here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Note that union evaluates the first argument first if necessary, that's why we can use ./c/a here
# Note that union evaluates the first argument first if necessary. That's why we can use ./c/a here
Suggested change
# Note that union evaluates the first argument first if necessary, that's why we can use ./c/a here
# Note that union evaluates the first argument first if necessary, so that's why we can use ./c/a here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lib The Nixpkgs function library 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants