de-inheritance CmdEdit for InstallableValueCommand

Change-Id: If85ea78954a45470b0b25c08dc7d40bfebd53610
This commit is contained in:
Qyriad 2024-06-17 14:39:19 -06:00
parent 079eeb1de7
commit 50be55ffca

View file

@ -1,4 +1,4 @@
#include "command-installable-value.hh" #include "command.hh"
#include "shared.hh" #include "shared.hh"
#include "eval.hh" #include "eval.hh"
#include "attr-path.hh" #include "attr-path.hh"
@ -10,7 +10,7 @@
using namespace nix; using namespace nix;
struct CmdEdit : InstallableValueCommand struct CmdEdit : InstallableCommand
{ {
std::string description() override std::string description() override
{ {
@ -26,17 +26,19 @@ struct CmdEdit : InstallableValueCommand
Category category() override { return catSecondary; } Category category() override { return catSecondary; }
void run(ref<Store> store, ref<InstallableValue> installable) override void run(ref<Store> store, ref<Installable> installable) override
{ {
auto state = getEvalState(); auto state = getEvalState();
auto const installableValue = InstallableValue::require(installable);
const auto [file, line] = [&] { const auto [file, line] = [&] {
auto [v, pos] = installable->toValue(*state); auto [v, pos] = installableValue->toValue(*state);
try { try {
return findPackageFilename(*state, *v, installable->what()); return findPackageFilename(*state, *v, installable->what());
} catch (NoPositionInfo &) { } catch (NoPositionInfo &) {
throw Error("cannot find position information for '%s", installable->what()); throw Error("cannot find position information for '%s", installableValue->what());
} }
}(); }();