Skip to content

Commit 82a6444

Browse files
authored
CreateOrMergeNixConfig: set expected nix.conf mode to 644, not 664 (#1316)
* CreateOrMergeNixConfig: set expected nix.conf mode to 644, not 664 It has apparently been like this since the start[1], but that was probably a typo. Let's stop perpetuating it. [1]: https://github.com/NixOS/nix/blob/121020fc508b5731209cc158986f1e78fb99ed9f/scripts/install-multi-user.sh#L967 * CreateOrMergeNixConfig: don't error when mode is different When we write out the new or merged config, we'll set it to our expected mode anyways, so there's no need to error if it's different.
1 parent 229832d commit 82a6444

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

src/action/base/create_or_merge_nix_config.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::action::{
1818
/// The `nix.conf` configuration names that are safe to merge.
1919
// FIXME(@cole-h): make configurable by downstream users?
2020
const MERGEABLE_CONF_NAMES: &[&str] = &["experimental-features"];
21-
const NIX_CONF_MODE: u32 = 0o664;
21+
const NIX_CONF_MODE: u32 = 0o644;
2222
const NIX_CONF_COMMENT_CHAR: char = '#';
2323

2424
#[non_exhaustive]
@@ -147,19 +147,6 @@ impl CreateOrMergeNixConfig {
147147
return Err(Self::error(ActionErrorKind::PathWasNotFile(path)));
148148
}
149149

150-
// Does the file have the right permissions?
151-
let discovered_mode = metadata.permissions().mode();
152-
// We only care about user-group-other permissions
153-
let discovered_mode = discovered_mode & 0o777;
154-
155-
if discovered_mode != NIX_CONF_MODE {
156-
return Err(Self::error(ActionErrorKind::PathModeMismatch(
157-
path,
158-
discovered_mode,
159-
NIX_CONF_MODE,
160-
)));
161-
}
162-
163150
let existing_nix_config = NixConfig::parse_file(&path)
164151
.map_err(CreateOrMergeNixConfigError::ParseNixConfig)
165152
.map_err(Self::error)?;

0 commit comments

Comments
 (0)