1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

fixup! Add an 'add-root' comamnd to manually add indirect roots

This commit is contained in:
Guillaume Maudoux 2024-09-16 00:47:44 +02:00
parent fee7efbc09
commit 9465b1947e

View file

@ -9,7 +9,7 @@
using namespace nix; using namespace nix;
struct CmdAddRoot: StoreCommand struct CmdAddRoot : StoreCommand
{ {
std::vector<std::string> links; std::vector<std::string> links;
bool checkResults = true; bool checkResults = true;
@ -31,17 +31,20 @@ struct CmdAddRoot: StoreCommand
std::string doc() override std::string doc() override
{ {
return return
#include "add-root.md" #include "add-root.md"
; ;
} }
Category category() override { return catSecondary; } Category category() override
{
return catSecondary;
}
void run(ref<Store> store) override void run(ref<Store> store) override
{ {
auto & indirectRootStore = require<IndirectRootStore>(*store); auto & indirectRootStore = require<IndirectRootStore>(*store);
for (auto &link: links) { for (auto & link : links) {
auto indirectPath = absPath(link); auto indirectPath = absPath(link);
if (indirectRootStore.isInStore(indirectPath)) { if (indirectRootStore.isInStore(indirectPath)) {
throw Error("Indirect root '%1%' must not be in the Nix store", link); throw Error("Indirect root '%1%' must not be in the Nix store", link);