Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
attrs.hh
Go to the documentation of this file.
1#pragma once
3
4#include "lix/libutil/json-fwd.hh"
6#include "lix/libutil/hash.hh"
7
8#include <variant>
9
10#include <optional>
11
12namespace nix::fetchers {
13
14typedef std::variant<std::string, uint64_t, Explicit<bool>> Attr;
15typedef std::map<std::string, Attr> Attrs;
16
17Attrs jsonToAttrs(const JSON & json);
18
19JSON attrsToJSON(const Attrs & attrs);
20
21std::optional<std::string> maybeGetStrAttr(const Attrs & attrs, const std::string & name);
22
23std::string getStrAttr(const Attrs & attrs, const std::string & name);
24
25std::optional<uint64_t> maybeGetIntAttr(const Attrs & attrs, const std::string & name);
26
27uint64_t getIntAttr(const Attrs & attrs, const std::string & name);
28
29std::optional<bool> maybeGetBoolAttr(const Attrs & attrs, const std::string & name);
30
31bool getBoolAttr(const Attrs & attrs, const std::string & name);
32
33std::map<std::string, std::string> attrsToQuery(const Attrs & attrs);
34
35}