From 1e5f13456075722c33f3348de61847b1bdf6b60c Mon Sep 17 00:00:00 2001 From: Qyriad Date: Mon, 17 Jun 2024 14:33:28 -0600 Subject: [PATCH] de-inheritance CmdEval for InstallableValueCommand Change-Id: I08b1702310e863d15de26dc838eb0bcb62417c10 --- src/nix/eval.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/nix/eval.cc b/src/nix/eval.cc index 469ff7391..9f265930b 100644 --- a/src/nix/eval.cc +++ b/src/nix/eval.cc @@ -1,4 +1,4 @@ -#include "command-installable-value.hh" +#include "command.hh" #include "common-args.hh" #include "print-options.hh" #include "shared.hh" @@ -12,13 +12,13 @@ using namespace nix; -struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption +struct CmdEval : MixJSON, InstallableCommand, MixReadOnlyOption { bool raw = false; std::optional apply; std::optional writeTo; - CmdEval() : InstallableValueCommand() + CmdEval() : InstallableCommand() { addFlag({ .longName = "raw", @@ -55,14 +55,16 @@ struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption Category category() override { return catSecondary; } - void run(ref store, ref installable) override + void run(ref store, ref installable) override { if (raw && json) throw UsageError("--raw and --json are mutually exclusive"); + auto const installableValue = InstallableValue::require(installable); + auto state = getEvalState(); - auto [v, pos] = installable->toValue(*state); + auto [v, pos] = installableValue->toValue(*state); NixStringContext context; if (apply) {