Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
context.hh
Go to the documentation of this file.
1#pragma once
3
4#include "comparator.hh"
5#include "derived-path.hh"
6#include "variant-wrapper.hh"
7
8#include <nlohmann/json_fwd.hpp>
9
10namespace nix {
11
12class BadNixStringContextElem : public Error
13{
14public:
15 std::string_view raw;
16
17 template<typename... Args>
18 BadNixStringContextElem(std::string_view raw_, const Args & ... args)
19 : Error("")
20 {
21 raw = raw_;
22 auto hf = HintFmt(args...);
23 err.msg = HintFmt("Bad String Context element: %1%: %2%", Uncolored(hf.str()), raw);
24 }
25};
26
33 using Opaque = SingleDerivedPath::Opaque;
34
44 struct DrvDeep {
45 StorePath drvPath;
46
47 GENERATE_CMP(DrvDeep, me->drvPath);
48 };
49
55 using Built = SingleDerivedPath::Built;
56
57 using Raw = std::variant<
58 Opaque,
59 DrvDeep,
60 Built
61 >;
62
63 Raw raw;
64
65 GENERATE_CMP(NixStringContextElem, me->raw);
66
67 MAKE_WRAPPER_CONSTRUCTOR(NixStringContextElem);
68
78 std::string_view s,
79 const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
80 std::string to_string() const;
81};
82
83typedef std::set<NixStringContextElem> NixStringContext;
84
85}
Definition args.hh:28
Definition fmt.hh:136
Definition path.hh:27
return s
Definition lexer.l:459
ErrorInfo err
Definition lexer.l:679
std::vector< Expr * > args
Definition lexer.l:6126
Definition config.hh:382
Definition context.hh:44
Definition context.hh:27
static NixStringContextElem parse(std::string_view s, const ExperimentalFeatureSettings &xpSettings=experimentalFeatureSettings)
Definition context.cc:8
SingleDerivedPath::Built Built
Definition context.hh:55
SingleDerivedPath::Opaque Opaque
Definition context.hh:33
Definition fmt.hh:120