#pragma once #include "installable-value.hh" namespace nix { /** * Extra info about a \ref DerivedPath "derived path" that ultimately * come from a Flake. * * Invariant: every ExtraPathInfo gotten from an InstallableFlake should * be possible to downcast to an ExtraPathInfoFlake. */ struct ExtraPathInfoFlake : ExtraPathInfoValue { /** * Extra struct to get around C++ designated initializer limitations */ struct Flake { FlakeRef originalRef; FlakeRef resolvedRef; }; Flake flake; ExtraPathInfoFlake(Value && v, Flake && f) : ExtraPathInfoValue(std::move(v)), flake(f) { } }; struct InstallableFlake : InstallableValue { FlakeRef flakeRef; Strings attrPaths; Strings prefixes; ExtendedOutputsSpec extendedOutputsSpec; const flake::LockFlags & lockFlags; mutable std::shared_ptr _lockedFlake; InstallableFlake( SourceExprCommand * cmd, ref state, FlakeRef && flakeRef, std::string_view fragment, ExtendedOutputsSpec extendedOutputsSpec, Strings attrPaths, Strings prefixes, const flake::LockFlags & lockFlags); std::string what() const override { return flakeRef.to_string() + "#" + *attrPaths.begin(); } std::vector getActualAttrPaths(); Value * getFlakeOutputs(EvalState & state, const flake::LockedFlake & lockedFlake); DerivedPathsWithInfo toDerivedPaths() override; std::pair toValue(EvalState & state) override; /** * Get a cursor to every attrpath in getActualAttrPaths() that * exists. However if none exists, throw an exception. */ std::vector> getCursors(EvalState & state) override; std::shared_ptr getLockedFlake() const; FlakeRef nixpkgsFlakeRef() const override; }; ref openEvalCache( EvalState & state, std::shared_ptr lockedFlake); }