From 4a3deef2a0f3c5a2b155314d5cfa2134772c5178 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Wed, 8 Mar 2023 12:44:11 -0800 Subject: [PATCH] Fixup a couple differences with the official installer scripts (#311) * Fixup a couple differences with the official installer scripts * Fixup broken tests --- src/action/base/create_or_merge_nix_config.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/action/base/create_or_merge_nix_config.rs b/src/action/base/create_or_merge_nix_config.rs index 6c209eb..4f43faa 100644 --- a/src/action/base/create_or_merge_nix_config.rs +++ b/src/action/base/create_or_merge_nix_config.rs @@ -16,7 +16,7 @@ use crate::action::{Action, ActionDescription, ActionError, ActionTag, StatefulA /// The `nix.conf` configuration names that are safe to merge. // FIXME(@cole-h): make configurable by downstream users? const MERGEABLE_CONF_NAMES: &[&str] = &["experimental-features"]; -const NIX_CONF_MODE: u32 = 0o644; +const NIX_CONF_MODE: u32 = 0o664; const NIX_CONF_COMMENT_CHAR: char = '#'; #[non_exhaustive] @@ -590,6 +590,7 @@ mod test { "experimental-features = flakes\nwarn-dirty = true\n", ) .await?; + tokio::fs::set_permissions(&test_file, PermissionsExt::from_mode(NIX_CONF_MODE)).await?; let mut nix_config = NixConfig::new(); nix_config @@ -631,6 +632,7 @@ mod test { "# test 2\n# test\nexperimental-features = flakes # some inline comment about experimental-features\n# the following line should be warn-dirty = true\nwarn-dirty = true # this is an inline comment\n# this is an ungrouped comment\n# this too", ) .await?; + tokio::fs::set_permissions(&test_file, PermissionsExt::from_mode(NIX_CONF_MODE)).await?; let mut nix_config = NixConfig::new(); nix_config .settings_mut() @@ -662,6 +664,7 @@ mod test { let test_file = temp_dir.path().join("preserves_comments"); write(test_file.as_path(), " a = b\n c = d# lol\n# e = f").await?; + tokio::fs::set_permissions(&test_file, PermissionsExt::from_mode(NIX_CONF_MODE)).await?; let mut nix_config = NixConfig::new(); nix_config .settings_mut()