Skip to content

Commit

Permalink
fixup: cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-h committed Nov 8, 2024
1 parent a452ef9 commit 445188e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/action/common/configure_init_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl Action for ConfigureInitService {
Command::new("launchctl")
.process_group(0)
.arg("enable")
.arg(&format!("{domain}/{service}"))
.arg(format!("{domain}/{service}"))
.stdin(std::process::Stdio::null()),
)
.await
Expand All @@ -283,7 +283,7 @@ impl Action for ConfigureInitService {
.process_group(0)
.arg("kickstart")
.arg("-k")
.arg(&format!("{domain}/{service}"))
.arg(format!("{domain}/{service}"))
.stdin(std::process::Stdio::null()),
)
.await
Expand Down
2 changes: 1 addition & 1 deletion src/action/macos/bootstrap_launchctl_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Action for BootstrapLaunchctlService {
Command::new("launchctl")
.process_group(0)
.arg("enable")
.arg(&format!("{DARWIN_LAUNCHD_DOMAIN}/{service}"))
.arg(format!("{DARWIN_LAUNCHD_DOMAIN}/{service}"))
.stdin(std::process::Stdio::null()),
)
.await
Expand Down
2 changes: 1 addition & 1 deletion src/action/macos/encrypt_apfs_volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl EncryptApfsVolume {
command.arg("-s");
command.arg("Nix Store");
command.arg("-l");
command.arg(&format!("{} encryption password", disk.display()));
command.arg(format!("{} encryption password", disk.display()));
command.arg("-D");
command.arg("Encrypted volume password");
command.process_group(0);
Expand Down
50 changes: 25 additions & 25 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,31 @@ impl crate::diagnostics::ErrorDiagnostic for InstallSettingsError {
}
}

pub fn determinate_nix_settings() -> nix_config_parser::NixConfig {
let mut cfg = nix_config_parser::NixConfig::new();
let settings = cfg.settings_mut();

settings.insert("netrc-file".into(), "/nix/var/determinate/netrc".into());

let extra_substituters = ["https://cache.flakehub.com"];
match settings.entry("extra-substituters".to_string()) {
Entry::Occupied(mut slot) => {
let slot_mut = slot.get_mut();
for extra_substituter in extra_substituters {
if !slot_mut.contains(extra_substituter) {
*slot_mut += " ";
*slot_mut += extra_substituter;
}
}
},
Entry::Vacant(slot) => {
let _ = slot.insert(extra_substituters.join(" "));
},
};

cfg
}

#[cfg(test)]
mod tests {
use super::{FromStr, PathBuf, Url, UrlOrPath, UrlOrPathOrString};
Expand Down Expand Up @@ -689,28 +714,3 @@ mod tests {
Ok(())
}
}

pub fn determinate_nix_settings() -> nix_config_parser::NixConfig {
let mut cfg = nix_config_parser::NixConfig::new();
let settings = cfg.settings_mut();

settings.insert("netrc-file".into(), "/nix/var/determinate/netrc".into());

let extra_substituters = ["https://cache.flakehub.com"];
match settings.entry("extra-substituters".to_string()) {
Entry::Occupied(mut slot) => {
let slot_mut = slot.get_mut();
for extra_substituter in extra_substituters {
if !slot_mut.contains(extra_substituter) {
*slot_mut += " ";
*slot_mut += extra_substituter;
}
}
},
Entry::Vacant(slot) => {
let _ = slot.insert(extra_substituters.join(" "));
},
};

cfg
}

0 comments on commit 445188e

Please sign in to comment.