1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
///@file

#include "lix/libcmd/installable-value.hh"
#include "lix/libexpr/eval-cache.hh"
#include "lix/libstore/outputs-spec.hh"
#include "lix/libcmd/command.hh"
#include "lix/libcmd/common-eval-args.hh"
#include "lix/libexpr/eval.hh"

namespace nix {

class InstallableAttrPath : public InstallableValue
{
    SourceExprCommand & cmd;
    RootValue v;
    std::string attrPath;
    ExtendedOutputsSpec extendedOutputsSpec;

    InstallableAttrPath(
        ref<eval_cache::CachingEvaluator> state,
        SourceExprCommand & cmd,
        Value & v,
        const std::string & attrPath,
        ExtendedOutputsSpec extendedOutputsSpec
    );

    std::string what() const override { return attrPath; };

    std::pair<Value, PosIdx> toValue(EvalState & state) override;

    DerivedPathsWithInfo toDerivedPaths(EvalState & state) override;

public:

    static InstallableAttrPath parse(
        ref<eval_cache::CachingEvaluator> state,
        SourceExprCommand & cmd,
        Value & v,
        std::string_view prefix,
        ExtendedOutputsSpec extendedOutputsSpec
    );
};

}