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