Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
attrs.hh File Reference
#include "nix/util/types.hh"
#include "nix/util/hash.hh"
#include "nix/util/ref.hh"
#include "nix/util/fun.hh"
#include <variant>
#include <nlohmann/json_fwd.hpp>
#include <optional>

Go to the source code of this file.

Classes

struct  nix::fetchers::LazyAttrComputation
class  nix::fetchers::LazyAttr
struct  nix::fetchers::Attr

Typedefs

using nix::fetchers::ResolvedAttr = std::variant<std::string, uint64_t, Explicit<bool>>
typedef std::map< std::string, Attr > nix::fetchers::Attrs

Functions

ResolvedAttr nix::fetchers::forceAttr (const Attr &attr)
std::optional< LazyAttr > nix::fetchers::maybeGetLazyAttr (const Attrs &attrs, const std::string &name)
Attrs nix::fetchers::jsonToAttrs (const nlohmann::json &json)
nlohmann::json nix::fetchers::attrsToJSON (const Attrs &attrs)
std::optional< std::string > nix::fetchers::maybeGetStrAttr (const Attrs &attrs, const std::string &name)
std::string nix::fetchers::getStrAttr (const Attrs &attrs, const std::string &name)
std::optional< uint64_t > nix::fetchers::maybeGetIntAttr (const Attrs &attrs, const std::string &name)
uint64_t nix::fetchers::getIntAttr (const Attrs &attrs, const std::string &name)
std::optional< bool > nix::fetchers::maybeGetBoolAttr (const Attrs &attrs, const std::string &name)
bool nix::fetchers::getBoolAttr (const Attrs &attrs, const std::string &name)
StringMap nix::fetchers::attrsToQuery (const Attrs &attrs)
Hash nix::fetchers::getRevAttr (const Attrs &attrs, const std::string &name)

Typedef Documentation

◆ Attrs

typedef std::map<std::string, Attr> nix::fetchers::Attrs

An Attrs can be thought of a JSON object restricted or simplified to be "flat", not containing any subcontainers (arrays or objects) and also not containing any nulls.

◆ ResolvedAttr

using nix::fetchers::ResolvedAttr = std::variant<std::string, uint64_t, Explicit<bool>>

The resolved (non-lazy) subset of attribute value types.

Function Documentation

◆ forceAttr()

ResolvedAttr nix::fetchers::forceAttr ( const Attr & attr)

Force a potentially lazy attribute to its resolved value.

◆ maybeGetLazyAttr()

std::optional< LazyAttr > nix::fetchers::maybeGetLazyAttr ( const Attrs & attrs,
const std::string & name )

Retrieve an attr, but only if it's a LazyAttr.