Skip to content

Change the derivation schema attribute to derivationAttrPath#52

Merged
edolstra merged 3 commits intomainfrom
derivation-attr-path
Feb 27, 2026
Merged

Change the derivation schema attribute to derivationAttrPath#52
edolstra merged 3 commits intomainfrom
derivation-attr-path

Conversation

@edolstra
Copy link
Collaborator

@edolstra edolstra commented Feb 27, 2026

derivation was fishy because it allows the schema to transform the derivation, or to construct an entirely new derivation. That might be useful sometimes, but flake schemas should describe what's in the output, not add entirely new stuff.

Also remove isDerivation checks because Nix now automatically checks that the attribute corresponding to derivationAttrPath is a derivation.

Summary by CodeRabbit

  • Refactor
    • Changed how derivation metadata is represented: items now reference derivations by attribute paths or empty paths rather than embedding full derivation objects, without altering public APIs.
  • Chores
    • Manifest outputs now use an explicit inventory wrapper and include a top-level version field.
  • Tests
    • Test diffs stabilized by sorting before comparison; test fixtures updated to nest derivation info and add per-system targets.

`derivation` was fishy because it allows the schema to transform the
derivation, or to construct an entirely new derivation. That might be
useful sometimes, but flake schemas should describe what's in the
output, not add entirely new stuff.

Also remove `isDerivation` checks because Nix now automatically checks
that the attribute corresponding to `derivationAttrPath` is a
derivation.
@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

📝 Walkthrough

Walkthrough

Refactors how derivation metadata is represented: inlined derivations are removed and replaced by attribute-path references (derivationAttrPath) or by nesting derivation metadata; test fixtures and outputs are updated to an inventory-wrapped schema with versioning and per-system targeting.

Changes

Cohort / File(s) Summary
Flake schema changes
flake.nix
Removed checkDerivation and stopped embedding derivation objects; switched schemas to record derivationAttrPath (explicit paths or empty arrays) instead of inlined derivations.
Test fixtures — inventory shape & derivation nesting
tests/checks.json, tests/packages.json, tests/legacyPackages.json, tests/nixos.json, tests/schemas.json
Moved root objects under inventory with version: 2; replaced derivationName/leaf patterns with derivation: { name: ... }, added forSystems arrays, removed leaf flags, and adjusted nested shapes to match new representation.
Test outputs & harness
tests/schemas.check-err, tests/flake.nix
Updated expected test output lines for schema checks; test harness now sorts both sides of diffs before comparing to avoid order nondeterminism.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • cole-h

Poem

🐰 I hopped through flaky fields today,
Took nested bits and tucked them away.
Paths now point where outputs hide,
No more derivations stuck inside.
🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: renaming the derivation schema attribute to derivationAttrPath, which is the primary purpose of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch derivation-attr-path

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/flake.nix (1)

84-85: Harden sorted diff command for deterministic shell behavior.

Line 85 should quote both file paths and set a fixed locale for sort to avoid locale-dependent ordering.

Proposed patch
-                      wdiff <(sort < $src/tests/$flake.check-err) <(sort < "$flake.check-err")
+                      wdiff <(LC_ALL=C sort < "$src/tests/$flake.check-err") <(LC_ALL=C sort < "$flake.check-err")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/flake.nix` around lines 84 - 85, Update the wdiff invocation so both
file arguments are quoted and sorting uses a fixed locale: wrap the process
substitution paths in quotes (e.g. <(sort < "$src/tests/$flake.check-err") and
<(sort < "$flake.check-err")) and prefix the sort calls with LC_ALL=C (i.e.
LC_ALL=C sort) to ensure deterministic, locale-independent ordering for the
wdiff comparison.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/flake.nix`:
- Around line 84-85: Update the wdiff invocation so both file arguments are
quoted and sorting uses a fixed locale: wrap the process substitution paths in
quotes (e.g. <(sort < "$src/tests/$flake.check-err") and <(sort <
"$flake.check-err")) and prefix the sort calls with LC_ALL=C (i.e. LC_ALL=C
sort) to ensure deterministic, locale-independent ordering for the wdiff
comparison.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f6f77a0 and 9cda110.

⛔ Files ignored due to path filters (1)
  • tests/flake.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • tests/checks.json
  • tests/flake.nix
  • tests/legacyPackages.json
  • tests/nixos.json
  • tests/packages.json
  • tests/schemas.check-err
  • tests/schemas.json

@edolstra edolstra merged commit d6a6b7c into main Feb 27, 2026
2 checks passed
@edolstra edolstra deleted the derivation-attr-path branch February 27, 2026 13:54
@coderabbitai coderabbitai bot mentioned this pull request Mar 10, 2026
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

Successfully merging this pull request may close these issues.

2 participants