Skip to content

Commit

Permalink
when user isn't trusted, still display the new public key
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Apr 2, 2024
1 parent e106743 commit fb081dd
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions devenv/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,25 @@ impl App {
} else {
"sudo launchctl kickstart -k system/org.nixos.nix-daemon"
};

self.logger
.info(&format!("Using Cachix: {}", caches.caches.pull.join(", ")));
if !new_known_keys.is_empty() {
for (name, pubkey) in new_known_keys.iter() {
self.logger.info(&format!(
"Trusting {}.cachix.org on first use with the public key {}",
name, pubkey
));
}
caches.known_keys.extend(new_known_keys);
}

std::fs::write(
&self.cachix_trusted_keys,
serde_json::to_string(&caches.known_keys).unwrap(),
)
.expect("Failed to write cachix caches to file");

if trusted == Some(0) {
self.logger.error(&indoc::formatdoc!(
"You're not a trusted user of the Nix store. You have the following options:
Expand Down Expand Up @@ -328,23 +347,6 @@ impl App {
));
bail!("You're not a trusted user of the Nix store.")
}

self.logger
.info(&format!("Using Cachix: {}", caches.caches.pull.join(", ")));
if !new_known_keys.is_empty() {
for (name, pubkey) in new_known_keys.iter() {
self.logger.info(&format!(
"Trusting {}.cachix.org on first use with the public key {}",
name, pubkey
));
}
caches.known_keys.extend(new_known_keys);
}
std::fs::write(
&self.cachix_trusted_keys,
serde_json::to_string(&caches.known_keys).unwrap(),
)
.expect("Failed to write cachix caches to file")
}

self.cachix_caches = Some(caches.clone());
Expand Down

0 comments on commit fb081dd

Please sign in to comment.