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