Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/action/common/place_nix_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ impl PlaceNixConfiguration {
experimental_features.join(" "),
);

// 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());
Comment on lines +130 to 134
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.


// https://github.com/NixOS/nix/pull/8047
Expand Down
Loading