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