This cannot be done in the hydra-evaluator systemd unit, since then every other Nix process (e.g. hydra-evaluator and nix-prefetch-*) will also allocate the specified heap size, probably leading to OOM.
ZVSHXE3KY43J5BBDGERORR2FAVDG4ARANUUSGIYDHUN767SQ4GAQC
HK2F7SKQJNQWMQM3WMEX5IQ2JW4UKMDSEQCZMJQE3QTNO7KLZFHAC
FHVJYJFEZEGR6DVIQ2HGE7DLWA65QAGAI3K2KACGNM2JTDJTRJ4AC
K7IOFWLNEO2TAP7ZW5UW2CRQAU26UDO5WFZWVEJ63AIMP4ACJHBQC
STZE4KKRL2AGCPP2FOMBNZHJTRTKJQZSEKALWEV6FK5BII6H7EDAC
F57YJP5PXPSZ5LOOGU4QIFL5YB2OPDPXY6NIGKZNMSAJTCOM5M2QC
M3A5PZIHA3LDVTBTKGTLCYGJSMNJOFXNO5GBPAUDHO5XGHLKYYPQC
FV2M6MOTAP4BJMEKU5XUDVEACWEJGEIRCCE2MRY3F6SF2SFOE3MQC
KNLKTCDMQNYJ2Y4B7PDQ4WLZUSYKU4VV74YDCDJH5OBCYGP7W4VQC
4N5APGRGHTKFMEJ7THSJX6TSYYAP3BUZQG73AJBKCQLXOOEHPATQC
7GKAIP3VYKM4MGGHOGBB3DR2M6B6SENBR5IZQVJYO65AWT4BW7LAC
24BMQDZAWDQ7VNIA7TIROXSOYLOJBNZ2E4264WHWNJAEN6ZB3UOAC
XCDTFZUYSOYEARMJCV4ORVQWG2VWZQ43HU2U63RBECP53OSCM2GQC
NSBNNM77LKRFLORJOW4NB2WXDWHC3MKRNLGRCLUKKZZXWZK7TJFAC
ENXUSMSVOU3AZFMH2ZXR4ZVPV2LRRQYQJ6IFX33YN6IH2ORSNSAAC
SJQC2I3NWRUIGLQGRZ2X6C2QGKLL5DLWFNOAJ6J774P2LOAOJP5QC
UUN5WH4DROFHVK7JXS2ICAR2WTZDNVDEVFAXKVO6RJ3D5OLKE5ZAC
XCHAKH4D4JH7FZKX4BSOBRRC5O23MSCDHU3XCQLPLJS3LFKW5YQQC
GJV2J5HXFKVF7BXNFMTI6ZZMYADXIKTFIQJ3FONJ7DPVCUJZ2L4AC
HJOEIMLRDVQ2KZI5HGL2HKGBM3AHP7YIKGKDAGFUNKRUXVRB24NAC
SL3WSRACCX2IMJHHLTRAUQT7QDLCOKYLVO2FEHWIHXM5GPKSRJTQC
V2UCCYN3B6266BDKGSXQDRSW4HKY673GINM3VI3MORXZ7OYDJBXAC
5AIYUMTBY6TFQTBRP3MJ2PYWUMRF57I77NIVWYE74UMEVQMBWZVQC
BG6PEOB2M2Y56QPVMELU7VNNCGNMSQ2K6ATBUCPJLKPLTDWNJQ5AC
4YCF3KBGI4VYKHJXAREJLCJLY3UWB2FX447CJ4XQWFRKRFKG5WCQC
struct Config
{
std::map<std::string, std::string> options;
Config()
{
/* Read hydra.conf. */
auto hydraConfigFile = getEnv("HYDRA_CONFIG");
if (pathExists(hydraConfigFile)) {
for (auto line : tokenizeString<Strings>(readFile(hydraConfigFile), "\n")) {
line = trim(string(line, 0, line.find('#')));
auto eq = line.find('=');
if (eq == std::string::npos) continue;
auto key = trim(std::string(line, 0, eq));
auto value = trim(std::string(line, eq + 1));
if (key == "") continue;
options[key] = value;
}
}
}
std::string getStrOption(const std::string & key, const std::string & def = "")
{
auto i = options.find(key);
return i == options.end() ? def : i->second;
}
uint64_t getIntOption(const std::string & key, uint64_t def = 0)
{
auto i = options.find(key);
return i == options.end() ? def : std::stoll(i->second);
}
bool getBoolOption(const std::string & key, bool def = false)
{
auto i = options.find(key);
return i == options.end() ? def : (i->second == "true" || i->second == "1");
}
};
#pragma once
#include <map>
#include "util.hh"
struct Config
{
std::map<std::string, std::string> options;
Config()
{
using namespace nix;
/* Read hydra.conf. */
auto hydraConfigFile = getEnv("HYDRA_CONFIG");
if (pathExists(hydraConfigFile)) {
for (auto line : tokenizeString<Strings>(readFile(hydraConfigFile), "\n")) {
line = trim(string(line, 0, line.find('#')));
auto eq = line.find('=');
if (eq == std::string::npos) continue;
auto key = trim(std::string(line, 0, eq));
auto value = trim(std::string(line, eq + 1));
if (key == "") continue;
options[key] = value;
}
}
}
std::string getStrOption(const std::string & key, const std::string & def = "")
{
auto i = options.find(key);
return i == options.end() ? def : i->second;
}
uint64_t getIntOption(const std::string & key, uint64_t def = 0)
{
auto i = options.find(key);
return i == options.end() ? def : std::stoll(i->second);
}
bool getBoolOption(const std::string & key, bool def = false)
{
auto i = options.find(key);
return i == options.end() ? def : (i->second == "true" || i->second == "1");
}
};