Conversation
WalkthroughAdds a per-system Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Flake as flake.outputs
participant PerSys as per-system generator
participant Formatter as formatter.${system}
participant DevShell as devShells.${system}
Note over Flake,PerSys: forEachSupportedSystem now receives { pkgs, system }
Dev->>Flake: inspect flake outputs
Flake->>PerSys: instantiate per-system outputs (pkgs, system)
PerSys->>Formatter: produce system-specific formatter (nixfmt-rfc-style)
PerSys->>DevShell: build devShell including self.formatter.${system} and ponysay
Dev->>DevShell: nix develop / activate
Dev->>Formatter: run formatter inside devShell (format/check)
Note right of Formatter #DFF2E1: formatter exposed as public per-system output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ 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). (1)
🔇 Additional comments (3)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
default/flake.nix (1)
20-31: Fix: passsystemintoforEachSupportedSystem’s lambda (build is failing).
fis called withoutsystem, but downstream lambdas destructure{ pkgs, system }, causing: “anonymous lambda called without required argument 'system'.” Update the helper to includesystemin the attrset you pass tof.forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems ( system: - f { - pkgs = import inputs.nixpkgs { - inherit system; - # Enable using unfree packages - config.allowUnfree = true; - }; - } + f { + inherit system; + pkgs = import inputs.nixpkgs { + inherit system; + # Enable using unfree packages + config.allowUnfree = true; + }; + } );
🧹 Nitpick comments (3)
default/flake.nix (3)
46-49: Nit: drop unnecessarywith pkgs.
packagesonly referencesself.formatter.${system}, notpkgs. Removewith pkgs;to avoid scope pollution.- packages = with pkgs; [ + packages = [ # Add the flake's formatter to your project's environment self.formatter.${system} ];
65-68: Docs nit: simplify formatting commands.If you’re on a recent Nix that supports
nix fmt, users can just runnix fmt(andnix fmt --check) without piping file lists.- # To format all Nix files: - # git ls-files '*.nix' | xargs nix fmt - # To check formatting: - # git ls-files '*.nix' | xargs nixfmt --check + # To format all Nix files in the repo: + # nix fmt + # To check formatting (no changes written): + # nix fmt --check
69-69: Optional: add a fallback ifnixfmt-rfc-styleisn’t in the pinned nixpkgs.Some channels may not expose
pkgs.nixfmt-rfc-style. Usingorprevents evaluations from failing and keeps the docs’nixfmtcommands working.- formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt-rfc-style); + formatter = forEachSupportedSystem ({ pkgs, ... }: + pkgs.nixfmt-rfc-style or pkgs.nixfmt + );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
default/flake.nix(2 hunks)
🧰 Additional context used
🪛 GitHub Actions: .github/workflows/ci.yaml
default/flake.nix
[error] 24-24: Nix flake evaluation error: anonymous lambda called without required argument 'system'. (flake.nix:24:11)
[error] 41-41: Nix flake evaluation error: anonymous lambda called without required argument 'system'. (flake.nix:41:9)
🔇 Additional comments (1)
default/flake.nix (1)
41-41: LGTM once helper passessystem.After the helper fix above, this
{ pkgs, system }destructuring will evaluate cleanly.Re-run CI after the helper change to confirm both errors at Line 24 and Line 41 disappear.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
default/flake.nix (3)
48-51: Drop unnecessarywith pkgs;and consider a lighter shell.
with pkgsisn’t used here; removing it avoids polluting scope. Optional: usemkShellNoCCto trim closure when the shell only adds tools.Apply this diff:
- packages = with pkgs; [ + packages = [ # Add the flake's formatter to your project's environment self.formatter.${system} ];Optionally:
- default = pkgs.mkShell { + default = pkgs.mkShellNoCC {
62-70: Tighten formatter docs to prefernix fmt.Since you provide a
formatter, the simplest path isnix fmt; pass-through args work for checks.Apply this diff:
- # To format all Nix files: - # git ls-files '*.nix' | xargs nix fmt - # To check formatting: - # git ls-files '*.nix' | xargs nixfmt --check + # To format: + # nix fmt + # To check formatting (pass-through to nixfmt): + # nix fmt -- --check
71-71: Replace deprecatednixfmt-rfc-stylewithnixfmtand verify availability
Ensure your pinned nixpkgs provides the newpkgs.nixfmtattribute (which supersedesnixfmt-rfc-style); if it isn’t available, fall back topkgs.alejandra.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
default/flake.nix(3 hunks)
🔇 Additional comments (3)
default/flake.nix (3)
25-25: Propagatingsystemis correct.This enables downstream lambdas to destructure
systemcleanly (needed forself.formatter.${system}). LGTM.
38-41: Activation docs look good.Clear and accurate for a template. LGTM.
43-43: Destructuring{ pkgs, system }is appropriate.Matches the updated generator contract and usage below. LGTM.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
.github/workflows/ci.yaml (1)
41-42: Prefer the flake’s own formatter to avoid version skew.Now that the flake exposes a per‑system
formatter, call it instead of a pinned remote to keep CI/dev parity. Also add--togit ls-filesfor pathspec safety.- git ls-files -z '*.nix' | \ - xargs -0 -r nix run "https://flakehub.com/f/NixOS/nixpkgs/0.2505.808723#nixfmt-rfc-style" -- --check + git ls-files -z -- '*.nix' | \ + xargs -0 -r nix run .#formatter -- --checkIf your runner has a recent Nix with
nix fmt, an alternative is:- git ls-files -z '*.nix' | \ - xargs -0 -r nix run "https://flakehub.com/f/NixOS/nixpkgs/0.2505.808723#nixfmt-rfc-style" -- --check + git ls-files -z -- '*.nix' | \ + xargs -0 -r nix fmt -- --checkdefault/flake.nix (2)
43-55: mkShellNoCC and package set look solid; tiny style nit.Optional: avoid
with pkgs;to reduce scope pollution and ease grepability.- default = pkgs.mkShellNoCC { - # The Nix packages provided in the environment - packages = with pkgs; [ - # Add the flake's formatter to your project's environment - self.formatter.${system} - - # Other packages - curl - jq - ]; + default = pkgs.mkShellNoCC { + # The Nix packages provided in the environment + packages = [ + # Add the flake's formatter to your project's environment + self.formatter.${system} + + # Other packages + pkgs.curl + pkgs.jq + ];
66-76: Unify docs with CI: prefer flake‑local formatter; keep NUL‑safety.Use the local
formatterfor checks and add--togit ls-filesfor pathspec separation.- # To format all Nix files: - # git ls-files -z '*.nix' | xargs -0 -r nix fmt - # To check formatting: - # git ls-files -z '*.nix' | xargs -0 -r nixfmt --check + # To format all Nix files: + # git ls-files -z -- '*.nix' | xargs -0 -r nix fmt + # To check formatting (uses this flake's formatter): + # git ls-files -z -- '*.nix' | xargs -0 -r nix run .#formatter -- --checkThe
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt-rfc-style);definition itself looks correct and matches RFC‑166 conventions.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/ci.yaml(1 hunks)default/flake.nix(3 hunks)
🔇 Additional comments (2)
default/flake.nix (2)
25-25: Good: passsysteminto the per‑system generator.This unblocks using system‑aware outputs elsewhere (e.g.,
self.formatter.${system}).
38-41: Docs addition LGTM.Clear activation hints for
nix develop/direnv.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/ci.yaml(1 hunks)default/flake.nix(3 hunks)nix-darwin/flake.nix(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: .github/workflows/ci.yaml
nix-darwin/flake.nix
[error] 153-153: nix flake check failed: undefined variable 'forEachSupportedSystem' at nix-darwin/flake.nix:153. Command 'nix flake check --all-systems "./${flake}"' exited with code 1.
🔇 Additional comments (7)
.github/workflows/ci.yaml (1)
27-27: Quote change has no functional impact.The change from single quotes to double quotes is cosmetic and doesn't affect functionality in this context.
nix-darwin/flake.nix (2)
139-141: Good addition, but depends on fixing the formatter definition.Adding the formatter to the dev shell packages is a good practice. However, this will only work once the
formatteroutput definition at line 153 is fixed.
143-152: Excellent documentation for formatter usage.The comments clearly explain the RFC 166 standard and provide practical examples for both formatting and checking. This will help users understand how to use the formatter.
default/flake.nix (4)
25-25: Proper system parameter propagation.Adding
inherit system;at line 25 and updating the devShells signature to accept{ pkgs, system }at line 43 correctly enables per-system references likeself.formatter.${system}. This is the right pattern for accessing per-system outputs.Also applies to: 43-43
46-54: Good use ofmkShellNoCCand formatter integration.Using
mkShellNoCCis appropriate for development shells that don't require C compilation tooling. Includingself.formatter.${system}in the packages makes the formatter readily available in the dev environment, following best practices.Note:
ponysayappears to be added as an example package.
37-41: Helpful activation instructions.The added comments clearly explain how to activate the development environment using both
nix developanddirenv allow, making it easier for users to get started.
64-74: Formatter properly implemented with excellent documentation.The formatter output is correctly defined using
forEachSupportedSystemandpkgs.nixfmt-rfc-style, following RFC 166 standards. The documentation provides clear examples for both formatting and checking, which will help users adopt consistent formatting practices.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
nix-darwin/flake.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). (1)
- GitHub Check: checks
🔇 Additional comments (1)
nix-darwin/flake.nix (1)
139-142: Good addition of formatter to devShell.Making the formatter available in the development shell enables convenient formatting within the
nix developenvironment. The reference toself.formatter.${system}is valid due to Nix's lazy evaluation of attribute sets.
| # Nix formatter | ||
|
|
||
| # This applies the formatter that follows RFC 166, which defines a standard format: | ||
| # https://github.com/NixOS/rfcs/pull/166 | ||
|
|
||
| # To format all Nix files: | ||
| # git ls-files -z '*.nix' | xargs -0 -r nix fmt | ||
| # To check formatting: | ||
| # git ls-files -z '*.nix' | xargs -0 -r nix develop --command nixfmt --check | ||
| formatter.${system} = inputs.nixpkgs.legacyPackages.${system}.nixfmt-rfc-style; |
There was a problem hiding this comment.
❓ Verification inconclusive
Excellent fix for the previous undefined variable issue.
The formatter definition now correctly uses formatter.${system} instead of the previously undefined forEachSupportedSystem helper, resolving the critical pipeline failure. The implementation properly references nixfmt-rfc-style, which implements RFC 166.
However, please verify that the nixfmt binary provided by nixfmt-rfc-style supports the --check flag mentioned in the comment on line 152. Some formatters use different verification flags.
Run this script to verify the formatter's CLI options:
🏁 Script executed:
#!/bin/bash
# Verify that nixfmt-rfc-style supports the --check flag
# Get the formatter package and check its help output
nix eval --raw ".#formatter.aarch64-darwin" --apply 'p: p.outPath' | xargs -I {} cat {}/bin/nixfmt 2>/dev/null || echo "Binary check requires building the package"
# Alternative: Check the package's help text
nix shell ".#formatter.aarch64-darwin" --command nixfmt --help 2>&1 | grep -i "check\|verify"Length of output: 41
Line 152 uses incorrect nixfmt flag; should use --verify instead of --check.
The code comment on line 152 suggests using nixfmt --check, but nixfmt includes a --verify flag to check idempotency, not --check. The --check flag is available in other formatters like nixpkgs-fmt, but not in nixfmt-rfc-style. Update the comment to:
# git ls-files -z '*.nix' | xargs -0 -r nix develop --command nixfmt --verify
🤖 Prompt for AI Agents
nix-darwin/flake.nix around lines 144 to 153: the comment shows using `nixfmt
--check` which is the wrong flag for nixfmt; change the example command in the
comment to use `--verify` instead (i.e. replace `nixfmt --check` with `nixfmt
--verify`) so the documentation matches nixfmt-rfc-style behavior.
Summary by CodeRabbit
New Features
Documentation
Chores