To use the local Nix store (default):
store_mode = direct
To use a local binary cache:
store_mode = local-binary-cache binary_cache_dir = /var/lib/hydra/binary-cache
To use an S3 bucket:
store_mode = s3-binary-cache binary_cache_s3_bucket = my-nix-bucket
Also, respect binary_cache_{secret,public}_key_file for signing the binary cache.
V2UCCYN3B6266BDKGSXQDRSW4HKY673GINM3VI3MORXZ7OYDJBXAC GJV2J5HXFKVF7BXNFMTI6ZZMYADXIKTFIQJ3FONJ7DPVCUJZ2L4AC 5AIYUMTBY6TFQTBRP3MJ2PYWUMRF57I77NIVWYE74UMEVQMBWZVQC 24BMQDZAWDQ7VNIA7TIROXSOYLOJBNZ2E4264WHWNJAEN6ZB3UOAC SOB276BAWH23OUKJUXGDWCLDIM2OISD5NKF743NTQ3L572L4BS3QC K5G5GZY7D7KWVR5RAGZFHH3ZPG5OCLZT4HZ6XIJJ7YYVUMC2CTZQC OG3Z3QGCG2FNDGF4VQYWOXLZCF7LGTZCUMGKUCBNAPAQ5FRFHQ2AC HJOEIMLRDVQ2KZI5HGL2HKGBM3AHP7YIKGKDAGFUNKRUXVRB24NAC /* 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;
auto store = std::make_shared<S3BinaryCacheStore>([this]() { return this->getLocalStore(); },"/home/eelco/hydra/secret","/home/eelco/hydra/public","nix-test-cache");store->init();_destStore = store;
if (storeMode == "direct" || storeMode == "") {_destStore = openStore();}else if (storeMode == "local-binary-cache") {auto dir = hydraConfig["binary_cache_dir"];if (dir == "")throw Error("you must set ‘binary_cache_dir’ in hydra.conf");auto store = make_ref<LocalBinaryCacheStore>([this]() { return this->getLocalStore(); },"/home/eelco/Misc/Keys/test.nixos.org/secret","/home/eelco/Misc/Keys/test.nixos.org/public",dir);store->init();_destStore = std::shared_ptr<LocalBinaryCacheStore>(store);}else if (storeMode == "s3-binary-cache") {auto bucketName = hydraConfig["binary_cache_s3_bucket"];if (bucketName == "")throw Error("you must set ‘binary_cache_s3_bucket’ in hydra.conf");auto store = make_ref<S3BinaryCacheStore>([this]() { return this->getLocalStore(); },hydraConfig["binary_cache_secret_key_file"],hydraConfig["binary_cache_public_key_file"],bucketName);store->init();_destStore = std::shared_ptr<S3BinaryCacheStore>(store);}