Skip to content

Enable auto-optimise-store on macOS#1793

Open
grahamc wants to merge 1 commit intomainfrom
grahamc-patch-2
Open

Enable auto-optimise-store on macOS#1793
grahamc wants to merge 1 commit intomainfrom
grahamc-patch-2

Conversation

@grahamc
Copy link
Copy Markdown
Member

@grahamc grahamc commented Mar 5, 2026

The issue that caused us to disable it was fixed in November: NixOS/nix#14676

Description
Checklist
  • Formatted with cargo fmt
  • Built with nix build
  • Ran flake checks with nix flake check
  • Added or updated relevant tests (leave unchecked if not applicable)
  • Added or updated relevant documentation (leave unchecked if not applicable)
  • Linked to related issues (leave unchecked if not applicable)
Validating with install.determinate.systems

If a maintainer has added the upload to s3 label to this PR, it will become available for installation via install.determinate.systems:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix/pr/$PR_NUMBER | sh -s -- install

Summary by CodeRabbit

  • Bug Fixes
    • Fixed auto-optimise-store setting to now apply consistently across all platforms, including macOS, which was previously excluded.

The issue that caused us to disable it was fixed in November: NixOS/nix#14676
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

Removed conditional compilation logic that previously prevented the auto-optimise-store = true setting from being applied on macOS. The setting is now added unconditionally across all platforms.

Changes

Cohort / File(s) Summary
Configuration Gatekeeping Removal
src/action/common/place_nix_configuration.rs
Removed #[cfg(not(target_os = "macos"))] attribute to enable auto-optimise-store = true universally. Updated surrounding comments with fix references.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Suggested reviewers

  • colemickens
  • lucperkins

Poem

🐰✨ A wall once stood, keeping stores at bay,
But now all platforms get to optimize today!
macOS joins the festive cheer,
No gates to block, just clear and clear!
Hoppy coding, friends! 🍀

🚥 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 'Enable auto-optimise-store on macOS' directly and clearly summarizes the main change: removing the conditional compilation attribute to allow the auto-optimise-store setting on macOS builds.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch grahamc-patch-2

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 `@src/action/common/place_nix_configuration.rs`:
- Around line 130-134: The change unconditionally sets "auto-optimise-store" to
"true" in place_nix_configuration.rs (settings.insert("auto-optimise-store"...))
but there is no regression test verifying this platform-agnostic behavior; add a
unit test that calls the function that constructs the Nix settings (the
place_nix_configuration or the helper that returns the settings map) and asserts
that the returned map contains key "auto-optimise-store" with value "true"
regardless of target OS, to prevent reintroducing the old macOS gate.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3c3c2fe1-803e-4efa-a73b-ae90b91bd141

📥 Commits

Reviewing files that changed from the base of the PR and between 2c98095 and dbd1a51.

📒 Files selected for processing (1)
  • src/action/common/place_nix_configuration.rs

Comment on lines +130 to 134
// Previously disabled on macOS due to:
// https://github.com/DeterminateSystems/nix-installer/issues/449#issuecomment-1551782281
#[cfg(not(target_os = "macos"))]
// But was fixed:
// https://github.com/NixOS/nix/pull/14676
settings.insert("auto-optimise-store".to_string(), "true".to_string());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a regression test for unconditional auto-optimise-store = true.

This PR changes a platform-specific behavior, but there’s no direct assertion for it. A focused test will lock the intended behavior and prevent accidental reintroduction of the old gate.

🧪 Proposed test addition
 #[cfg(test)]
 mod tests {
     use super::*;
 
+    #[tokio::test]
+    async fn standard_config_enables_auto_optimise_store() -> eyre::Result<()> {
+        let standard_nix_config = PlaceNixConfiguration::setup_standard_config(None).await?;
+        assert!(
+            matches!(
+                standard_nix_config.settings().get("auto-optimise-store"),
+                Some(value) if value == "true"
+            ),
+            "auto-optimise-store should be enabled in standard config"
+        );
+        Ok(())
+    }
+
     #[tokio::test]
     async fn extra_trusted_cache() -> eyre::Result<()> {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Previously disabled on macOS due to:
// https://github.com/DeterminateSystems/nix-installer/issues/449#issuecomment-1551782281
#[cfg(not(target_os = "macos"))]
// But was fixed:
// https://github.com/NixOS/nix/pull/14676
settings.insert("auto-optimise-store".to_string(), "true".to_string());
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn standard_config_enables_auto_optimise_store() -> eyre::Result<()> {
let standard_nix_config = PlaceNixConfiguration::setup_standard_config(None).await?;
assert!(
matches!(
standard_nix_config.settings().get("auto-optimise-store"),
Some(value) if value == "true"
),
"auto-optimise-store should be enabled in standard config"
);
Ok(())
}
#[tokio::test]
async fn extra_trusted_cache() -> eyre::Result<()> {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/action/common/place_nix_configuration.rs` around lines 130 - 134, The
change unconditionally sets "auto-optimise-store" to "true" in
place_nix_configuration.rs (settings.insert("auto-optimise-store"...)) but there
is no regression test verifying this platform-agnostic behavior; add a unit test
that calls the function that constructs the Nix settings (the
place_nix_configuration or the helper that returns the settings map) and asserts
that the returned map contains key "auto-optimise-store" with value "true"
regardless of target OS, to prevent reintroducing the old macOS gate.

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