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