2020-10-06 08:18:44 +00:00
|
|
|
#pragma once
|
2023-04-01 03:18:41 +00:00
|
|
|
///@file
|
2020-10-06 08:18:44 +00:00
|
|
|
|
2022-03-17 22:29:15 +00:00
|
|
|
#include "derivations.hh"
|
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
|
|
|
|
2022-11-08 15:03:42 +00:00
|
|
|
bool useUidRange() const;
|
|
|
|
|
2021-06-24 13:06:07 +00:00
|
|
|
std::optional<nlohmann::json> prepareStructuredAttrs(Store & store, const StorePathSet & inputPaths);
|
2018-09-28 12:31:16 +00:00
|
|
|
};
|
|
|
|
|
2021-07-12 15:17:13 +00:00
|
|
|
std::string writeStructuredAttrsShell(const nlohmann::json & json);
|
2021-06-22 18:37:25 +00:00
|
|
|
|
2018-09-28 12:31:16 +00:00
|
|
|
}
|