Skip to content

Update to latest flake-schemas#388

Merged
edolstra merged 3 commits intomainfrom
eelcodolstra/nix-345-support-deprecated-flake-outputs
Mar 18, 2026
Merged

Update to latest flake-schemas#388
edolstra merged 3 commits intomainfrom
eelcodolstra/nix-345-support-deprecated-flake-outputs

Conversation

@edolstra
Copy link
Copy Markdown
Collaborator

@edolstra edolstra commented Mar 18, 2026

Motivation

This adds support for some deprecated output types. See DeterminateSystems/flake-schemas#59.

Context

Summary by CodeRabbit

  • New Features

    • Added defaultApp, defaultPackage, and devShell flake schemas (each includes deprecation guidance toward recommended alternatives).
  • Behavior

    • Attribute resolution now considers the new schemas alongside existing ones, changing candidate attribute path ordering and precedence for devShells/packages.
  • Bug Fixes

    • Improved runtime error handling for missing build outputs (now raises an error instead of an internal assertion).
  • Tests

    • Updated and added tests to reflect new attribute candidates and devShell precedence.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d28784ca-fe4a-4322-ad82-e072a702e07b

📥 Commits

Reviewing files that changed from the base of the PR and between 50c3cc2 and 3594a9c.

📒 Files selected for processing (3)
  • src/nix/develop.cc
  • tests/functional/config.nix.in
  • tests/functional/flakes/develop.sh

📝 Walkthrough

Walkthrough

Adds helper builders (mkApp, mkPackage, singleDerivationInventory), refactors apps/packages inventories to use them, introduces deprecation-facing public schemas (defaultApp, defaultPackage, devShell) and wires them into schema lookup; updates InstallableFlake attr-path ordering and adjusts related tests and develop runtime behavior.

Changes

Cohort / File(s) Summary
Flake schema helpers & public schemas
src/libcmd/builtin-flake-schemas.nix
Add mkApp, mkPackage, singleDerivationInventory; refactor appsSchema/packagesSchema to use helpers; add defaultAppSchema, defaultPackageSchema, devShellSchema and expose defaultApp, defaultPackage, devShell (with deprecation notes).
Schema integration (attr-path lookup)
src/libcmd/installable-flake.cc
Insert new schema lookups into InstallableFlake::getAttrPaths order: defaultApp after apps, devShell after devShells, and defaultPackage after packages, affecting candidate attrPath generation order.
Develop error handling
src/nix/develop.cc
Replace a debug assert for missing outputs with a runtime Error throw, changing error handling during derivation RC script generation.
Derivation test helper
tests/functional/config.nix.in
Add defaulted outputs argument to mkDerivation wrapper (outputs = args.outputs or ["out"]).
Functional tests: flakes
tests/functional/flakes/develop.sh, tests/functional/flakes/dubious-query.sh
Add tests asserting devShells/devShell/packages precedence; update dubious-query expected error to include defaultPackage.$system.<attr> among candidates.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant InstallableFlake as InstallableFlake
  participant SchemaRegistry as SchemaRegistry
  participant AttrPathBuilder as AttrPathBuilder

  Client->>InstallableFlake: request attr paths (role, system, attr)
  InstallableFlake->>SchemaRegistry: fetch ordered schemas (including defaultApp/defaultPackage/devShell)
  SchemaRegistry-->>InstallableFlake: ordered schema list
  InstallableFlake->>AttrPathBuilder: build candidate attrPaths from schemas
  AttrPathBuilder-->>InstallableFlake: candidate attrPaths
  InstallableFlake-->>Client: return attrPaths or error with candidates
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • cole-h
  • grahamc

Poem

🐇 I hop through flakes and tidy trails,
New helpers craft the app detail,
Defaults whisper where to be found,
Deprecated carrots soft and round,
Hooray — builds bounce homeward bound!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Update to latest flake-schemas' directly and accurately describes the main change: updating flake-schemas to support deprecated output types.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch eelcodolstra/nix-345-support-deprecated-flake-outputs
📝 Coding Plan
  • Generate coding plan for human review comments

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

Copy link
Copy Markdown

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/functional/flakes/dubious-query.sh`:
- Line 20: The assertion in dubious-query.sh hardcodes x86_64-linux inside the
grepQuiet expected error string; update that expectation to use the existing
$system variable (like the other paths) so the grepQuiet call checks
"defaultPackage.$system.foo?bar" instead of
"defaultPackage.x86_64-linux.foo?bar" to make the test system-agnostic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 241ee2aa-4753-426a-9eba-c02af83c57d1

📥 Commits

Reviewing files that changed from the base of the PR and between 35a0be5 and 0046d56.

📒 Files selected for processing (3)
  • src/libcmd/builtin-flake-schemas.nix
  • src/libcmd/installable-flake.cc
  • tests/functional/flakes/dubious-query.sh

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 18, 2026

@github-actions github-actions bot temporarily deployed to pull request March 18, 2026 10:37 Inactive
This adds support for some deprecated output types.
@edolstra edolstra force-pushed the eelcodolstra/nix-345-support-deprecated-flake-outputs branch from 0046d56 to 50c3cc2 Compare March 18, 2026 12:28
@github-actions github-actions bot temporarily deployed to pull request March 18, 2026 12:30 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 18, 2026 15:01 Inactive
@edolstra edolstra added this pull request to the merge queue Mar 18, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 18, 2026
@edolstra edolstra added this pull request to the merge queue Mar 18, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 18, 2026
@edolstra edolstra added this pull request to the merge queue Mar 18, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 18, 2026
@edolstra edolstra added this pull request to the merge queue Mar 18, 2026
Merged via the queue into main with commit 2ae19ec Mar 18, 2026
28 checks passed
@edolstra edolstra deleted the eelcodolstra/nix-345-support-deprecated-flake-outputs branch March 18, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants