Skip to content

Re-work flake outputs#218

Open
lucperkins wants to merge 3 commits intomainfrom
update-flake-output-structure
Open

Re-work flake outputs#218
lucperkins wants to merge 3 commits intomainfrom
update-flake-output-structure

Conversation

@lucperkins
Copy link
Member

@lucperkins lucperkins commented Nov 12, 2025

I noticed that this was still using defaultPackage so I fixed that and did some other sprucing-up-type things, like reformatting.

Summary by CodeRabbit

  • Refactor

    • Reorganized flake/layout to produce per-system dev shells and packages for clearer system-specific builds.
  • Chores

    • Switched CI workflow checkout action to a newer version and adjusted related workflow step structure.
    • Made lockfile-driven sourcing more dynamic to follow the project's lock information.
  • Style

    • Reformatted several configuration imports and wrapped expressions for consistent readability.

@coderabbitai
Copy link

coderabbitai bot commented Nov 12, 2025

📝 Walkthrough

Walkthrough

Replaces hard-coded tarball fetches in default.nix and shell.nix with lockfile-driven lookup, restructures flake.nix outputs to an explicit { self, ... }@inputs signature with per-system devShells/packages and a forEachSupportedSystem helper, and bumps GitHub Actions checkout to actions/checkout@v6 across workflows.

Changes

Cohort / File(s) Summary
Lockfile-driven fetch / Import changes
default.nix, shell.nix
Replace fixed fetchTarball imports with logic that reads flake.lock to derive node name and use lock.nodes.${nodeName}.locked.{url,narHash} (with a fallback URL from locked.rev). Outer import wrapper and { src = ./.; } preserved.
Flake restructuring
flake.nix
Change outputs = inputs:outputs = { self, ... }@inputs:; import lib from inputs.nixpkgs; introduce supportedSystems and forEachSupportedSystem; convert devShells/packages to per-system attributes; add per-system formatter and bootspec package derivations using pkgs.rustPlatform.buildRustPackage.
Integration test syntactic change
synthesize/integration-test-cases/21.11-specialisations.nix
Rewrite an imports entry from an inline anonymous attrSet function to a parenthesized function expression (formatting/structural change only).
CI / Workflows — checkout bump & minor edits
.github/workflows/ci.yml, .github/workflows/json-schema.yaml, .github/workflows/update-flake-lock.yaml, .github/workflows/update.yml
Update actions/checkout@v5actions/checkout@v6 across workflows; adjust step structure/indentation; change cron quoting in some files; update-flake-lock.yaml adds a with: block with pr-title, pr-labels, and inputs parameters and other minor run command/name tweaks (e.g., nixpkgs-fmt --checknixfmt check).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰
I nibbled at locks and parsed each line,
Turned fixed tarballs into flake-driven twine.
Systems now tidy, shells per their name,
Checkout bumped onwards — the CI's the same.
Hop, build, and fluff — a tidy little rhyme.

🚥 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 'Re-work flake outputs' is directly related to the main changes, which significantly restructure the flake.nix outputs function signature and overall architecture.
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 update-flake-output-structure
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
flake.nix (2)

29-45: Consider updating to devShells for consistency.

While the current devShell output works, consider aligning with the modern flake schema for consistency with the packages restructuring:

-      devShell = forEachSupportedSystem (
+      devShells = forEachSupportedSystem (
         { system, pkgs }:
-        pkgs.mkShell {
-          name = "bootspec";
-
-          packages = with pkgs; [
-            cargo
-            rustc
-            clippy
-            codespell
-            nixpkgs-fmt
-            rustfmt
-            jsonschema # provides the jv tool
-            json-schema-for-humans # provides the generate-schema-doc tool
-          ];
+        {
+          default = pkgs.mkShell {
+            name = "bootspec";
+
+            packages = with pkgs; [
+              cargo
+              rustc
+              clippy
+              codespell
+              nixpkgs-fmt
+              rustfmt
+              jsonschema # provides the jv tool
+              json-schema-for-humans # provides the generate-schema-doc tool
+            ];
+          };
         }
       );

This would mirror the packages.<system>.default pattern and align with the modern flake schema.


47-60: Excellent packages restructuring that addresses the PR objective!

The new per-system packages structure with default and bootspec properly replaces the deprecated defaultPackage pattern. The use of self.packages.${system}.bootspec for the default is idiomatic and avoids duplication.

Minor simplification opportunity on line 55:

-            src = inputs.self;
+            src = self;

Since self is already in scope from the function signature { self, ... }@inputs, using it directly is more concise and idiomatic.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d762893 and 641c145.

📒 Files selected for processing (4)
  • default.nix (1 hunks)
  • flake.nix (2 hunks)
  • shell.nix (1 hunks)
  • synthesize/integration-test-cases/21.11-specialisations.nix (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: ValidateJsonSchema
  • GitHub Check: SynthesizeIntegration
  • GitHub Check: NixFormatting
  • GitHub Check: format
  • GitHub Check: build
🔇 Additional comments (5)
shell.nix (1)

1-4: LGTM! Clean formatting improvement.

The reformatted import expression is more concise while maintaining the same functionality.

default.nix (1)

1-4: LGTM! Consistent formatting with shell.nix.

The import expression formatting is clean and matches the style used in shell.nix.

synthesize/integration-test-cases/21.11-specialisations.nix (1)

11-18: LGTM! Improved readability.

The multi-line formatting of the function expression improves readability without changing behavior.

flake.nix (2)

6-26: Excellent modernization of the flake structure!

The explicit outputs function signature, lib import, and forEachSupportedSystem helper using lib.genAttrs are all best practices for modern Nix flakes. This provides a solid foundation for per-system outputs.


34-34: Good update to modern mkShell attribute!

The change from buildInputs to packages is the recommended attribute for mkShell in modern Nix.

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 (2)
flake.nix (1)

14-18: Consider whether x86_64-darwin should be included.

The supportedSystems list includes aarch64-darwin but excludes x86_64-darwin. If Intel Macs are still supported targets, this system should be added. Otherwise, this is intentional and can be ignored.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@flake.nix` around lines 14 - 18, The supportedSystems array currently lists
"aarch64-darwin" but omits "x86_64-darwin"; decide whether Intel macOS targets
must be supported and, if so, add "x86_64-darwin" to the supportedSystems list
(symbol: supportedSystems) in the flake.nix so flakes build on Intel Macs; if
omission was intentional, leave as-is and document the platform support
decision.
.github/workflows/update-flake-lock.yaml (1)

21-22: Confirm intentional scope limitation for flake input updates.

The inputs: nixpkgs configuration limits automatic updates to only the nixpkgs input, excluding flake-compat from automated lock updates. This may be intentional (flake-compat is stable), but please confirm this is the desired behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/update-flake-lock.yaml around lines 21 - 22, The workflow
currently restricts automated flake input updates to only "nixpkgs" (the inputs:
nixpkgs entry); verify whether you intended to exclude "flake-compat" from lock
updates and if not, update the workflow to include "flake-compat" alongside
"nixpkgs" in the inputs list so both inputs are considered for automated updates
(or alternatively add an explicit comment/PR description asserting that
flake-compat is intentionally omitted because it is stable and should not be
auto-updated).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/update-flake-lock.yaml:
- Around line 21-22: The workflow currently restricts automated flake input
updates to only "nixpkgs" (the inputs: nixpkgs entry); verify whether you
intended to exclude "flake-compat" from lock updates and if not, update the
workflow to include "flake-compat" alongside "nixpkgs" in the inputs list so
both inputs are considered for automated updates (or alternatively add an
explicit comment/PR description asserting that flake-compat is intentionally
omitted because it is stable and should not be auto-updated).

In `@flake.nix`:
- Around line 14-18: The supportedSystems array currently lists "aarch64-darwin"
but omits "x86_64-darwin"; decide whether Intel macOS targets must be supported
and, if so, add "x86_64-darwin" to the supportedSystems list (symbol:
supportedSystems) in the flake.nix so flakes build on Intel Macs; if omission
was intentional, leave as-is and document the platform support decision.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d520026b-0723-47ba-98a1-a390807cde97

📥 Commits

Reviewing files that changed from the base of the PR and between 641c145 and 58be3ed.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • .github/workflows/ci.yml
  • .github/workflows/json-schema.yaml
  • .github/workflows/update-flake-lock.yaml
  • .github/workflows/update.yml
  • default.nix
  • flake.nix
  • shell.nix

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.

1 participant