Skip to content

Conversation

@Enzime
Copy link
Member

@Enzime Enzime commented Oct 10, 2025

This is necessary for a test in Clan which passes --option store, otherwise these nix eval commands would fail by trying to use the wrong Nix Store.

Summary by CodeRabbit

  • Bug Fixes
    • Replaced deprecated Nix invocations to eliminate warnings and improve compatibility with newer environments. Behavior remains the same, including how configuration is extracted and applied.
  • Chores
    • Streamlined command execution by centralizing option handling, resulting in cleaner, more consistent script behavior without changing user-facing outcomes.

@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Walkthrough

Replaced two explicit nix CLI invocations with calls that reuse a shared nixOptions array: both substituters and trustedPublicKeys evaluations now use nix eval "${nixOptions[@]}" --apply toString .... Output destinations and surrounding logic remain the same.

Changes

Cohort / File(s) Summary
CLI invocation refactor
src/nixos-anywhere.sh
Switched two nix --extra-experimental-features 'nix-command flakes' eval --apply toString ... calls to nix eval "${nixOptions[@]}" --apply toString ... for extracting substituters and trusted-public-keys from the flake attribute path; no changes to file write behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title succinctly captures the primary change by stating that Nix options will now be passed when retrieving substituters in the nixos-anywhere script, which directly aligns with the updates in the PR summary and objectives.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch push-kpzzmyrtpqzt

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.

This is necessary for a test in Clan which passes `--option store`, otherwise
these `nix eval` commands would fail by trying to use the wrong Nix Store.
@Enzime Enzime force-pushed the push-kpzzmyrtpqzt branch from 42ecbe7 to 6188a84 Compare October 10, 2025 13:04
@Enzime Enzime marked this pull request as ready for review October 10, 2025 14:23
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 (1)
src/nixos-anywhere.sh (1)

1041-1042: Use --raw to avoid quoted values in nix.conf

The change correctly reuses nixOptions. Add --raw so the evaluated strings aren’t wrapped in quotes, yielding clean space-separated values in nix.conf.

Apply:

-    substituters=$(nix eval "${nixOptions[@]}" --apply toString "${flake}"#"${flakeAttr}".nix.settings.substituters)
-    trustedPublicKeys=$(nix eval "${nixOptions[@]}" --apply toString "${flake}"#"${flakeAttr}".nix.settings.trusted-public-keys)
+    substituters=$(nix eval "${nixOptions[@]}" --raw --apply toString "${flake}"#"${flakeAttr}".nix.settings.substituters)
+    trustedPublicKeys=$(nix eval "${nixOptions[@]}" --raw --apply toString "${flake}"#"${flakeAttr}".nix.settings.trusted-public-keys)

Optionally, to be resilient if these attrs are absent, you could default to empty:

substituters=$(nix eval "${nixOptions[@]}" --raw --expr "builtins.toString ((${flake}#${flakeAttr}).nix.settings.substituters or [])")
trustedPublicKeys=$(nix eval "${nixOptions[@]}" --raw --expr "builtins.toString ((${flake}#${flakeAttr}).nix.settings.\"trusted-public-keys\" or [])")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8221438 and 6188a84.

📒 Files selected for processing (1)
  • src/nixos-anywhere.sh (1 hunks)

@Enzime Enzime added this pull request to the merge queue Oct 10, 2025
Merged via the queue into main with commit 25d23ef Oct 10, 2025
5 checks passed
@Enzime Enzime deleted the push-kpzzmyrtpqzt branch October 10, 2025 14:51
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