Conversation
The issue that caused us to disable it was fixed in November: NixOS/nix#14676
📝 WalkthroughWalkthroughRemoved conditional compilation logic that previously prevented the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
src/action/common/place_nix_configuration.rs
| // 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()); |
There was a problem hiding this comment.
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.
| // 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.
The issue that caused us to disable it was fixed in November: NixOS/nix#14676
Description
Checklist
cargo fmtnix buildnix flake checkValidating with
install.determinate.systemsIf a maintainer has added the
upload to s3label to this PR, it will become available for installation viainstall.determinate.systems:Summary by CodeRabbit