forked from lix-project/lix
197feed51d
1. `DerivationOutput` now as the `std::variant` as a base class. And the variants are given hierarchical names under `DerivationOutput`. In8e0d0689be
@matthewbauer and I didn't know a better idiom, and so we made it a field. But this sort of "newtype" is anoying for literals downstream. Since then we leaned the base class, inherit the constructors trick, e.g. used in `DerivedPath`. Switching to use that makes this more ergonomic, and consistent. 2. `store-api.hh` and `derivations.hh` are now independent. Inbcde5456cc
I swapped the dependency, but I now know it is better to just keep on using incomplete types as much as possible for faster compilation and good separation of concerns.
46 lines
1 KiB
C++
46 lines
1 KiB
C++
#pragma once
|
|
|
|
#include "derivations.hh"
|
|
#include "store-api.hh"
|
|
|
|
#include <nlohmann/json_fwd.hpp>
|
|
|
|
namespace nix {
|
|
|
|
class ParsedDerivation
|
|
{
|
|
StorePath drvPath;
|
|
BasicDerivation & drv;
|
|
std::unique_ptr<nlohmann::json> structuredAttrs;
|
|
|
|
public:
|
|
|
|
ParsedDerivation(const StorePath & drvPath, BasicDerivation & drv);
|
|
|
|
~ParsedDerivation();
|
|
|
|
const nlohmann::json * getStructuredAttrs() const
|
|
{
|
|
return structuredAttrs.get();
|
|
}
|
|
|
|
std::optional<std::string> getStringAttr(const std::string & name) const;
|
|
|
|
bool getBoolAttr(const std::string & name, bool def = false) const;
|
|
|
|
std::optional<Strings> getStringsAttr(const std::string & name) const;
|
|
|
|
StringSet getRequiredSystemFeatures() const;
|
|
|
|
bool canBuildLocally(Store & localStore) const;
|
|
|
|
bool willBuildLocally(Store & localStore) const;
|
|
|
|
bool substitutesAllowed() const;
|
|
|
|
std::optional<nlohmann::json> prepareStructuredAttrs(Store & store, const StorePathSet & inputPaths);
|
|
};
|
|
|
|
std::string writeStructuredAttrsShell(const nlohmann::json & json);
|
|
|
|
}
|