diff --git a/lix/nix/doctor.cc b/lix/nix/doctor.cc index 156f26e3d..119a5c899 100644 --- a/lix/nix/doctor.cc +++ b/lix/nix/doctor.cc @@ -3,6 +3,7 @@ #include "lix/libcmd/command.hh" #include "lix/libexpr/eval-settings.hh" +#include "lix/libfetchers/registry.hh" #include "lix/libutil/logging.hh" #include "lix/libstore/serve-protocol.hh" #include "lix/libmain/shared.hh" @@ -20,6 +21,11 @@ namespace nix { namespace { +struct FlakeRegistryEntryFacts +{ + fetchers::Registry::Entry entry; +}; + std::string formatProtocol(unsigned int proto) { if (proto) { @@ -49,6 +55,7 @@ void checkInfo(const std::string & msg) { struct CmdDoctor : StoreCommand { bool success = true; + std::map flakeRegistryFacts; /** * This command is stable before the others @@ -83,6 +90,10 @@ struct CmdDoctor : StoreCommand Path profile = getEnv("NIX_PROFILE").value_or(getDefaultProfile()); checkValidCurrentProfileGeneration(profile); } + { + printInfo("Collecting information about the Flake registry"); + success &= checkFlakeRegistry(store); + } if (!success) throw Exit(2); @@ -156,6 +167,22 @@ struct CmdDoctor : StoreCommand return true; } + bool checkFlakeRegistry(ref store) + { + try { + auto registries = aio().blockOn(fetchers::getRegistries(store)); + for (auto & registry : registries) { + for (auto & entry : registry->entries) { + flakeRegistryFacts[entry.from.toURL().to_string()] = {.entry = entry}; + } + } + return true; + + } catch (...) { + return checkFail("Failed to obtain the Flake registry"); + } + } + bool checkNixInPath() { PathSet dirs;