Conversation
📝 WalkthroughWalkthroughThis pull request refactors Nix configuration files to modernize the build toolchain and structure. The formatter is switched from nixpkgs-fmt to nixfmt, with corresponding check updates. The flake.nix outputs structure is rewritten and expanded. Tests and check definitions are reformatted for consistency. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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: 1
🤖 Fix all issues with AI agents
In `@flake.nix`:
- Line 221: The flake references pkgs.nixfmt which does not exist in the pinned
nixpkgs; update the formatter entry to use the available pkgs.nixfmt-classic
(replace pkgs.nixfmt with pkgs.nixfmt-classic in the formatter = forAllSystems
({ pkgs, ... }: ...) expression) or alternatively update the pinned nixpkgs
revision to one that provides pkgs.nixfmt; ensure the change targets the
formatter declaration that uses forAllSystems and pkgs.
| } | ||
| ); | ||
|
|
||
| formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check nixfmt references and examine flake.lock for nixpkgs revision
rg -n 'nixfmt' flake.nix flake.lock
echo "---"
echo "Checking flake.lock for nixpkgs revision:"
rg -A5 '"nixpkgs"' flake.lock | head -20Repository: DeterminateSystems/nix-installer
Length of output: 838
🌐 Web query:
nixpkgs nixfmt RFC 166 package naming 2025 2026
💡 Result:
- RFC 166 is about standardizing Nix code formatting and establishing the Nix Formatting Team (which maintains the official formatter, nixfmt)—it’s not the RFC that defines nixpkgs package naming rules. [1]
- nixfmt in nixpkgs (naming / rollout timeline):
- The RFC-style formatter landed in nixpkgs as
nixfmt-rfc-style(testing call posted 2024-02-02). [2] - Formatting enforcement in nixpkgs CI was announced 2024-07-23, using nixfmt pinned in the nixpkgs dev environment. [3]
- A full tree-wide nixpkgs reformat PR was opened 2025-02-10, with a merge-party date noted as 2025-04-01. [4]
- nixfmt v1.0.0 (first stable release) was announced 2025-07-14. [5]
- The long-term plan was to rename
nixfmt-rfc-style→nixfmt, and by NixOS 25.11 nixpkgs provides the official formatter aspkgs.nixfmt-rfc-styleandpkgs.nixfmt. [6]
- The RFC-style formatter landed in nixpkgs as
- nixpkgs package naming conventions (separate from RFC 166):
- nixpkgs manual guidelines: generally follow upstream names, keep names lowercase, preserve dashes, and for “unstable” snapshots use
pkgname-unstable-YYYY-MM-DD. [7] - Wiki conventions for common suffixes (examples):
-bin,-unwrapped. [8]
- nixpkgs manual guidelines: generally follow upstream names, keep names lowercase, preserve dashes, and for “unstable” snapshots use
Sources:
[1] https://nixos.org/community/teams/formatting/
[2] https://discourse.nixos.org/t/call-for-testing-nix-formatter/39179
[3] https://discourse.nixos.org/t/enforcing-nix-formatting-in-nixpkgs/49506
[4] https://discourse.nixos.org/t/nix-formatting-team-full-nixpkgs-reformat/61867
[5] https://discourse.nixos.org/t/nixfmt-1-0-0-is-out/66537
[6] https://hackage.haskell.org/package/nixfmt
[7] https://releases.nixos.org/nixpkgs/nixpkgs-17.03pre90950.3ddf76c/manual/epub/OEBPS/ch10s02.html
[8] https://wiki.nixos.org/wiki/Package_naming_conventions
🏁 Script executed:
#!/bin/bash
# Extract the full nixpkgs revision from flake.lock
cat flake.lock | jq '.nodes.nixpkgs.locked' 2>/dev/null || rg -A10 '"nixpkgs"' flake.lock | grep -E '"rev"|"narHash"' | head -5Repository: DeterminateSystems/nix-installer
Length of output: 444
🏁 Script executed:
#!/bin/bash
# Check nixpkgs repository at the specific revision for nixfmt package
# The revision is: daf6dc47aa4b44791372d6139ab7b25269184d55
# Try to fetch nixfmt package info from that nixpkgs revision
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/tools/nix/nixfmt-rfc-style/default.nix" > /dev/null 2>&1 && echo "nixfmt-rfc-style exists" || echo "Could not verify"
# Also check if there's a nixfmt alias or direct package
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/tools/formatting/nixfmt/default.nix" > /dev/null 2>&1 && echo "nixfmt direct exists" || echo "Could not verify"
# Try to check all-packages.nix for nixfmt references around that revision
echo "Checking all-packages.nix for nixfmt entries..."
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -i "nixfmt" | head -10Repository: DeterminateSystems/nix-installer
Length of output: 215
🏁 Script executed:
#!/bin/bash
# Check what nixfmt refers to in all-packages.nix at that revision
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -A2 "^\s*nixfmt\s*=" | head -10Repository: DeterminateSystems/nix-installer
Length of output: 58
🏁 Script executed:
#!/bin/bash
# Search more broadly in all-packages.nix for any nixfmt definitions
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -E "nixfmt" | head -20Repository: DeterminateSystems/nix-installer
Length of output: 122
🏁 Script executed:
#!/bin/bash
# Check the nixfmt-rfc-style package definition
echo "=== Checking nixfmt-rfc-style/default.nix ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/tools/nix/nixfmt-rfc-style/default.nix" 2>/dev/null | head -20
echo ""
echo "=== Checking for nixfmt package/alias in tools/nix ==="
curl -s "https://api.github.com/repos/NixOS/nixpkgs/contents/pkgs/tools/nix?ref=daf6dc47aa4b44791372d6139ab7b25269184d55" 2>/dev/null | grep -E '"name".*nixfmt' | head -10
echo ""
echo "=== Broader search in all-packages.nix for nixfmt references ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -B2 -A2 "nixfmt" | head -20Repository: DeterminateSystems/nix-installer
Length of output: 466
🏁 Script executed:
#!/bin/bash
# The curl check said "nixfmt direct exists" but 404 suggests it doesn't
# Let me verify the curl result and check haskellPackages approach
echo "=== Verifying nixfmt-rfc-style path ==="
curl -I "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/tools/nix/nixfmt-rfc-style/default.nix" 2>/dev/null | head -5
echo ""
echo "=== List all in pkgs/tools/nix directory ==="
curl -s "https://api.github.com/repos/NixOS/nixpkgs/contents/pkgs/tools/nix?ref=daf6dc47aa4b44791372d6139ab7b25269184d55" 2>/dev/null | jq -r '.[] | select(.type=="dir") | .name' | grep -i nix
echo ""
echo "=== Check for nixfmt in formatting tools ==="
curl -s "https://api.github.com/repos/NixOS/nixpkgs/contents/pkgs/tools/formatting?ref=daf6dc47aa4b44791372d6139ab7b25269184d55" 2>/dev/null | jq -r '.[] | .name' | grep -i nixRepository: DeterminateSystems/nix-installer
Length of output: 535
🏁 Script executed:
#!/bin/bash
# Simpler approach: search all-packages.nix file content for nixfmt definitions
echo "=== Full nixfmt search in all-packages.nix ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -n "nixfmt" -i
echo ""
echo "=== Check if there's a aliases or re-exports ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -E "^\s+nix" | grep -i fmt | head -10
echo ""
echo "=== Direct check of the file size and structure around nixfmt ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | wc -lRepository: DeterminateSystems/nix-installer
Length of output: 345
🏁 Script executed:
#!/bin/bash
# Check the context around line 16526 to understand the nixfmt situation better
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | sed -n '16520,16535p'
echo ""
echo "=== Search for any nixfmt without hyphen in all-packages ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -E "^\s+nixfmt\s*="
echo ""
echo "=== Check haskellPackages definitions for nixfmt ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/haskell-packages.nix" 2>/dev/null | grep -i "nixfmt" | head -5Repository: DeterminateSystems/nix-installer
Length of output: 861
🏁 Script executed:
#!/bin/bash
# Final verification: does pkgs.nixfmt even exist as a valid reference?
# Check if there's any nixfmt (without -classic) defined anywhere
echo "=== Final search: nixfmt definitions without -classic ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -n "nixfmt[^-]" | head -10
echo ""
echo "=== Check if nixfmt is imported from another file ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | head -100 | grep -E "import|include" | head -10
echo ""
echo "=== Explicit check: is there a plain 'nixfmt' key at all? ==="
curl -s "https://raw.githubusercontent.com/NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55/pkgs/top-level/all-packages.nix" 2>/dev/null | grep -oE "^\s+nixfmt\s" | head -5Repository: DeterminateSystems/nix-installer
Length of output: 383
pkgs.nixfmt does not exist in the pinned nixpkgs revision.
At the pinned nixpkgs revision (daf6dc47aa4b44791372d6139ab7b25269184d55, Sept 2025), only nixfmt-classic is defined in pkgs. The formatter output references pkgs.nixfmt which will cause an evaluation error. Use pkgs.nixfmt-classic instead or update to a nixpkgs revision that provides pkgs.nixfmt as an alias to the RFC formatter.
🤖 Prompt for AI Agents
In `@flake.nix` at line 221, The flake references pkgs.nixfmt which does not exist
in the pinned nixpkgs; update the formatter entry to use the available
pkgs.nixfmt-classic (replace pkgs.nixfmt with pkgs.nixfmt-classic in the
formatter = forAllSystems ({ pkgs, ... }: ...) expression) or alternatively
update the pinned nixpkgs revision to one that provides pkgs.nixfmt; ensure the
change targets the formatter declaration that uses forAllSystems and pkgs.
This updates the installer repo to use the official Nix formatter rather than nixpkgs-fmt.
Summary by CodeRabbit
format-nixtool for Nix code formatting.