mirror of
https://github.com/NixOS/nix
synced 2025-07-02 21:51:50 +02:00
Merge toDerivations() into toDerivedPaths()
toDerivedPaths() now returns DerivedPathWithInfo, which is DerivedPath with some attributes needed by 'nix profile' etc. Preparation for #7417.
This commit is contained in:
parent
17373debe9
commit
845fc3f605
8 changed files with 154 additions and 162 deletions
|
@ -52,26 +52,42 @@ enum class OperateOn {
|
|||
Derivation
|
||||
};
|
||||
|
||||
struct ExtraInfo
|
||||
{
|
||||
std::optional<NixInt> priority;
|
||||
std::optional<FlakeRef> originalRef;
|
||||
std::optional<FlakeRef> resolvedRef;
|
||||
std::optional<std::string> attrPath;
|
||||
// FIXME: merge with DerivedPath's 'outputs' field?
|
||||
std::optional<OutputsSpec> outputsSpec;
|
||||
};
|
||||
|
||||
/* A derived path with any additional info that commands might
|
||||
need from the derivation. */
|
||||
struct DerivedPathWithInfo
|
||||
{
|
||||
DerivedPath path;
|
||||
ExtraInfo info;
|
||||
};
|
||||
|
||||
struct BuiltPathWithResult
|
||||
{
|
||||
BuiltPath path;
|
||||
ExtraInfo info;
|
||||
std::optional<BuildResult> result;
|
||||
};
|
||||
|
||||
typedef std::vector<DerivedPathWithInfo> DerivedPathsWithInfo;
|
||||
|
||||
struct Installable
|
||||
{
|
||||
virtual ~Installable() { }
|
||||
|
||||
virtual std::string what() const = 0;
|
||||
|
||||
virtual DerivedPaths toDerivedPaths() = 0;
|
||||
virtual DerivedPathsWithInfo toDerivedPaths() = 0;
|
||||
|
||||
virtual StorePathSet toDrvPaths(ref<Store> store)
|
||||
{
|
||||
throw Error("'%s' cannot be converted to a derivation path", what());
|
||||
}
|
||||
|
||||
DerivedPath toDerivedPath();
|
||||
DerivedPathWithInfo toDerivedPath();
|
||||
|
||||
UnresolvedApp toApp(EvalState & state);
|
||||
|
||||
|
@ -146,19 +162,6 @@ struct InstallableValue : Installable
|
|||
ref<EvalState> state;
|
||||
|
||||
InstallableValue(ref<EvalState> state) : state(state) {}
|
||||
|
||||
struct DerivationInfo
|
||||
{
|
||||
StorePath drvPath;
|
||||
std::set<std::string> outputsToInstall;
|
||||
std::optional<NixInt> priority;
|
||||
};
|
||||
|
||||
virtual std::vector<DerivationInfo> toDerivations() = 0;
|
||||
|
||||
DerivedPaths toDerivedPaths() override;
|
||||
|
||||
StorePathSet toDrvPaths(ref<Store> store) override;
|
||||
};
|
||||
|
||||
struct InstallableFlake : InstallableValue
|
||||
|
@ -186,9 +189,7 @@ struct InstallableFlake : InstallableValue
|
|||
|
||||
Value * getFlakeOutputs(EvalState & state, const flake::LockedFlake & lockedFlake);
|
||||
|
||||
std::tuple<std::string, FlakeRef, DerivationInfo> toDerivation();
|
||||
|
||||
std::vector<DerivationInfo> toDerivations() override;
|
||||
DerivedPathsWithInfo toDerivedPaths() override;
|
||||
|
||||
std::pair<Value *, PosIdx> toValue(EvalState & state) override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue