2020-10-06 08:18:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-03-21 15:07:16 +00:00
|
|
|
#include "store-api.hh"
|
2018-09-28 12:31:16 +00:00
|
|
|
|
2020-03-24 13:26:13 +00:00
|
|
|
#include <nlohmann/json_fwd.hpp>
|
2018-09-28 12:31:16 +00:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
class ParsedDerivation
|
|
|
|
{
|
2019-12-05 18:11:09 +00:00
|
|
|
StorePath drvPath;
|
2018-09-28 12:31:16 +00:00
|
|
|
BasicDerivation & drv;
|
2020-03-24 13:26:13 +00:00
|
|
|
std::unique_ptr<nlohmann::json> structuredAttrs;
|
2018-09-28 12:31:16 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2020-06-16 20:20:18 +00:00
|
|
|
ParsedDerivation(const StorePath & drvPath, BasicDerivation & drv);
|
2018-09-28 12:31:16 +00:00
|
|
|
|
2020-03-24 13:26:13 +00:00
|
|
|
~ParsedDerivation();
|
|
|
|
|
|
|
|
const nlohmann::json * getStructuredAttrs() const
|
2018-09-28 12:31:16 +00:00
|
|
|
{
|
2020-03-24 13:26:13 +00:00
|
|
|
return structuredAttrs.get();
|
2018-09-28 12:31:16 +00:00
|
|
|
}
|
|
|
|
|
2019-02-12 12:43:32 +00:00
|
|
|
std::optional<std::string> getStringAttr(const std::string & name) const;
|
2018-09-28 12:31:16 +00:00
|
|
|
|
|
|
|
bool getBoolAttr(const std::string & name, bool def = false) const;
|
|
|
|
|
2019-02-12 12:43:32 +00:00
|
|
|
std::optional<Strings> getStringsAttr(const std::string & name) const;
|
2018-09-28 12:31:16 +00:00
|
|
|
|
2018-09-28 13:57:27 +00:00
|
|
|
StringSet getRequiredSystemFeatures() const;
|
|
|
|
|
2020-08-12 16:32:36 +00:00
|
|
|
bool canBuildLocally(Store & localStore) const;
|
2018-09-28 12:31:16 +00:00
|
|
|
|
2020-08-12 16:32:36 +00:00
|
|
|
bool willBuildLocally(Store & localStore) const;
|
2019-09-03 14:02:12 +00:00
|
|
|
|
|
|
|
bool substitutesAllowed() const;
|
2021-05-02 15:24:14 +00:00
|
|
|
|
2021-05-13 14:11:56 +00:00
|
|
|
std::optional<nlohmann::json> prepareStructuredAttrs(std::optional<StringMap> inputRewrites, Store & store, const StorePathSet & inputPaths);
|
|
|
|
std::string writeStructuredAttrsShell(nlohmann::json & json);
|
2018-09-28 12:31:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|