Repository navigation
fix: import-tree class resolution and _ alias on batteries - #512
Merged
Merged
Conversation
Two regressions from the fx-pipeline:
1. import-tree only resolved for scope class (e.g. homeManager) but
never for other classes like nixos. The old resolver called the
parametric __fn once per class; the fx-pipeline provides class from
the scope handler, which only fires once. Fix: scan _<class>
directories eagerly via builtins.readDir instead of relying on the
class parameter.
2. The _ alias (provides shorthand) was missing on batteries with
__functor (import-tree, forward, etc). lib.isFunction returns true
for { __functor = ... } attrsets, routing them through
mergeFunctions' single-def fast path which returned the raw attrset
without provides forwarding or _ alias. Fix: forward provides
children and add _ in the fast path.
Fixes fileSystems regression reported by andrewix.
drupol
reviewed
May 11, 2026
drupol
approved these changes
May 11, 2026
sini
enabled auto-merge (squash)
May 11, 2026 18:02
charlesfire
pushed a commit
to charlesfire/den
that referenced
this pull request
May 16, 2026
## Summary - import-tree battery now scans `_<class>` directories eagerly via `builtins.readDir` instead of relying on the `class` scope parameter, which the fx-pipeline only provides once per scope (not once per class) - Batteries with `__functor` (import-tree, forward, etc.) now forward `provides` children and the `_` alias in the `mergeFunctions` single-def fast path, matching `mergeWithAspectMeta` behavior ## Test plan - [x] 771/771 CI tests pass - [x] andrewix config evaluates correctly — `fileSystems."/"` and `"/boot"` populated on andrew-laptop/andrew-pc - [x] WSL hosts correctly have empty fileSystems (no `_nixos` dir) - [x] `import-tree.test-no-import-for-missing-dir` passes (pathExists guard) - [x] `den._.import-tree._.host` resolves correctly (no `attribute '_' missing`)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_<class>directories eagerly viabuiltins.readDirinstead of relying on theclassscope parameter, which the fx-pipeline only provides once per scope (not once per class)__functor(import-tree, forward, etc.) now forwardprovideschildren and the_alias in themergeFunctionssingle-def fast path, matchingmergeWithAspectMetabehaviorTest plan
fileSystems."/"and"/boot"populated on andrew-laptop/andrew-pc_nixosdir)import-tree.test-no-import-for-missing-dirpasses (pathExists guard)den._.import-tree._.hostresolves correctly (noattribute '_' missing)