1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00

Merge pull request #10427 from lf-/jade/fix-nix-doctor

"but doctor, I AM the untrusted store": nix doctor had wrong trustedness
This commit is contained in:
Théophane Hufschmitt 2024-04-08 11:29:43 +02:00 committed by GitHub
commit c749c115ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 5 deletions

View file

@ -145,10 +145,14 @@ struct CmdConfigCheck : StoreCommand
void checkTrustedUser(ref<Store> store) void checkTrustedUser(ref<Store> store)
{ {
std::string_view trusted = store->isTrustedClient() if (auto trustedMay = store->isTrustedClient()) {
std::string_view trusted = trustedMay.value()
? "trusted" ? "trusted"
: "not trusted"; : "not trusted";
checkInfo(fmt("You are %s by store uri: %s", trusted, store->getUri())); checkInfo(fmt("You are %s by store uri: %s", trusted, store->getUri()));
} else {
checkInfo(fmt("Store uri: %s doesn't have a notion of trusted user", store->getUri()));
}
} }
}; };

View file

@ -1,4 +1,9 @@
source common.sh source common.sh
store_uri="ssh://localhost?remote-store=$TEST_ROOT/other-store"
# Check that store info trusted doesn't yet work with ssh:// # Check that store info trusted doesn't yet work with ssh://
nix --store ssh://localhost?remote-store=$TEST_ROOT/other-store store info --json | jq -e 'has("trusted") | not' nix --store "$store_uri" store info --json | jq -e 'has("trusted") | not'
# Suppress grumpiness about multiple nixes on PATH
(nix --store "$store_uri" doctor || true) 2>&1 | grep "doesn't have a notion of trusted user"

View file

@ -13,6 +13,8 @@ startDaemon
if isDaemonNewer "2.15pre0"; then if isDaemonNewer "2.15pre0"; then
# Ensure that ping works trusted with new daemon # Ensure that ping works trusted with new daemon
nix store info --json | jq -e '.trusted' nix store info --json | jq -e '.trusted'
# Suppress grumpiness about multiple nixes on PATH
(nix doctor || true) 2>&1 | grep 'You are trusted by'
else else
# And the the field is absent with the old daemon # And the the field is absent with the old daemon
nix store info --json | jq -e 'has("trusted") | not' nix store info --json | jq -e 'has("trusted") | not'