From c998e0172f31fd5707a8361962ec99b3ff9b1b10 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 5 Feb 2023 12:16:17 -0500 Subject: Move value-only methods to `InstallableValue` These methods would previously fail on the other `Installable`s, so moving them to this class is more correct as to where they actually work. Additionally, a `InstallableValueCommand` is created to make it easier (or rather no worse than before) to write commands that just work on `InstallableValue`s. Besides being a cleanup to avoid failing default methods, this gets us closer to https://github.com/NixOS/rfcs/pull/134. --- src/libcmd/installables.hh | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'src/libcmd/installables.hh') diff --git a/src/libcmd/installables.hh b/src/libcmd/installables.hh index 6c2922d89..c5f3cd683 100644 --- a/src/libcmd/installables.hh +++ b/src/libcmd/installables.hh @@ -18,19 +18,6 @@ struct SourceExprCommand; namespace eval_cache { class EvalCache; class AttrCursor; } -struct App -{ - std::vector context; - Path program; - // FIXME: add args, sandbox settings, metadata, ... -}; - -struct UnresolvedApp -{ - App unresolved; - App resolve(ref evalStore, ref store); -}; - enum class Realise { /* Build the derivation. Postcondition: the derivation outputs exist. */ @@ -92,13 +79,6 @@ struct Installable DerivedPathWithInfo toDerivedPath(); - UnresolvedApp toApp(EvalState & state); - - virtual std::pair toValue(EvalState & state) - { - throw Error("argument '%s' cannot be evaluated", what()); - } - /* Return a value only if this installable is a store path or a symlink to it. */ virtual std::optional getStorePath() @@ -106,16 +86,6 @@ struct Installable return {}; } - /* Get a cursor to each value this Installable could refer to. However - if none exists, throw exception instead of returning empty vector. */ - virtual std::vector> - getCursors(EvalState & state); - - /* Get the first and most preferred cursor this Installable could refer - to, or throw an exception if none exists. */ - virtual ref - getCursor(EvalState & state); - virtual FlakeRef nixpkgsFlakeRef() const { return FlakeRef::fromAttrs({{"type","indirect"}, {"id", "nixpkgs"}}); -- cgit v1.2.3