Skip to content

Add a way to control inclusion of empty directories in builtins.path results #8820

@infinisil

Description

@infinisil

Is your feature request related to a problem? Please describe.
It's currently not possible to efficiently import a path to the store while not including empty directories or directories that would be filtered out. The only way to make it work at all is using recursive readDir calls as done in e.g. NixOS/nixpkgs#188301 and my recent file set combinator work in NixOS/nixpkgs#222981 and NixOS/nixpkgs#245623. Supporting this would also address #4585.

This issue is sponsored by Antithesis

Describe the solution you'd like
A way to control whether empty directories end up in the result of builtins.path:

builtins.path {
  # Whether to include a directory that's empty or fully filtered out, defaulting to true for backwards compat
  includeEmptyDir = path: <bool>;
}

Priorities

Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature request or proposal

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions