Compare commits

..

1 commit

Author SHA1 Message Date
Yureka
f037de5ad8 fix build with latest lix 2024-10-06 13:50:15 +02:00
16 changed files with 115 additions and 130 deletions

2
.envrc
View file

@ -1 +1 @@
use flake .#clang
use flake

View file

@ -4,17 +4,6 @@
Hydra is a [Continuous Integration](https://en.wikipedia.org/wiki/Continuous_integration) service for [Nix](https://nixos.org/nix) based projects.
## Branches
| Branch | Lix release | Maintained |
| --- | --- | --- |
| `main` | [`main` branch of Lix](https://git.lix.systems/lix-project/lix/commits/branch/main) | ✅ |
| `lix-2.91` | [2.91](https://lix.systems/blog/2024-08-12-lix-2.91-release/) | ✅ |
Active development happens on `main` only.
Branches that track a Lix release are maintained as long as the Lix version is
maintained. These only receive critical bugfixes.
## Installation And Setup
**Note**: The instructions provided below are intended to enable new users to get a simple, local installation up and running. They are by no means sufficient for running a production server, let alone a public instance.

View file

@ -24,11 +24,11 @@
]
},
"locked": {
"lastModified": 1730504689,
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
@ -48,11 +48,11 @@
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1732112222,
"narHash": "sha256-H7GN4++a4vE49SUNojZx+FSk4mmpb2ifJUtJMJHProI=",
"lastModified": 1728159440,
"narHash": "sha256-8DW+VfSIk5xYpYj1VDKMmUjXhMooIlAOwYG4J9PLbbg=",
"ref": "refs/heads/main",
"rev": "66f6dbda32959dd5cf3a9aaba15af72d037ab7ff",
"revCount": 16513,
"rev": "7ff60b7445ccb599edcbf0078d181034f61a0859",
"revCount": 16318,
"type": "git",
"url": "https://git.lix.systems/lix-project/lix"
},
@ -74,11 +74,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1732351635,
"narHash": "sha256-H94CcQ3yamG5+RMxtxXllR02YIlxQ5WD/8PcolO9yEA=",
"lastModified": 1723579251,
"narHash": "sha256-xnHtfw0gRhV+2S9U7hQwvp2klTy1Iv7FlMMO0/WiMVc=",
"ref": "refs/heads/main",
"rev": "dfc286ca3dc49118c30d8d6205d6d6af76c62b7a",
"revCount": 617,
"rev": "42a160bce2fd9ffebc3809746bc80cc7208f9b08",
"revCount": 609,
"type": "git",
"url": "https://git.lix.systems/lix-project/nix-eval-jobs"
},
@ -95,11 +95,11 @@
]
},
"locked": {
"lastModified": 1731952509,
"narHash": "sha256-p4gB3Rhw8R6Ak4eMl8pqjCPOLCZRqaehZxdZ/mbFClM=",
"lastModified": 1720066371,
"narHash": "sha256-uPlLYH2S0ACj0IcgaK9Lsf4spmJoGejR9DotXiXSBZQ=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "7b5f051df789b6b20d259924d349a9ba3319b226",
"rev": "622f829f5fe69310a866c8a6cd07e747c44ef820",
"type": "github"
},
"original": {
@ -111,11 +111,11 @@
"nix2container": {
"flake": false,
"locked": {
"lastModified": 1724996935,
"narHash": "sha256-njRK9vvZ1JJsP8oV2OgkBrpJhgQezI03S7gzskCcHos=",
"lastModified": 1720642556,
"narHash": "sha256-qsnqk13UmREKmRT7c8hEnz26X3GFFyIQrqx4EaRc1Is=",
"owner": "nlewo",
"repo": "nix2container",
"rev": "fa6bb0a1159f55d071ba99331355955ae30b3401",
"rev": "3853e5caf9ad24103b13aa6e0e8bcebb47649fe4",
"type": "github"
},
"original": {
@ -126,16 +126,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1733120037,
"narHash": "sha256-En+gSoVJ3iQKPDU1FHrR6zIxSLXKjzKY+pnh9tt+Yts=",
"lastModified": 1725001927,
"narHash": "sha256-eV+63gK0Mp7ygCR0Oy4yIYSNcum2VQwnZamHxYTNi+M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f9f0d5c5380be0a599b1fb54641fa99af8281539",
"rev": "6e99f2a27d600612004fbd2c3282d614bfee6421",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
@ -159,11 +159,11 @@
"pre-commit-hooks": {
"flake": false,
"locked": {
"lastModified": 1726745158,
"narHash": "sha256-D5AegvGoEjt4rkKedmxlSEmC+nNLMBPWFxvmYnVLhjk=",
"lastModified": 1721042469,
"narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "4e743a6920eab45e8ba0fbe49dc459f1423a4b74",
"rev": "f451c19376071a90d8c58ab1a953c6e9840527fd",
"type": "github"
},
"original": {
@ -187,11 +187,11 @@
]
},
"locked": {
"lastModified": 1732292307,
"narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=",
"lastModified": 1723454642,
"narHash": "sha256-S0Gvsenh0II7EAaoc9158ZB4vYyuycvMGKGxIbERNAM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "705df92694af7093dfbb27109ce16d828a79155f",
"rev": "349de7bc435bdff37785c2466f054ed1766173be",
"type": "github"
},
"original": {

View file

@ -1,7 +1,7 @@
{
description = "A Nix-based continuous build system";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
inputs.lix.url = "git+https://git.lix.systems/lix-project/lix";
inputs.lix.inputs.nixpkgs.follows = "nixpkgs";

View file

@ -1,9 +1,9 @@
#include "db.hh"
#include "hydra-config.hh"
#include "lix/libmain/shared.hh"
#include "lix/libutil/logging.hh"
#include "lix/libutil/pool.hh"
#include "lix/libutil/signals.hh"
#include "logging.hh"
#include "pool.hh"
#include "shared.hh"
#include "signals.hh"
#include <algorithm>
#include <thread>
@ -513,14 +513,14 @@ int main(int argc, char * * argv)
std::vector<std::string> args;
LegacyArgs(argv[0], [&](Strings::iterator & arg, const Strings::iterator & end) {
parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
if (*arg == "--unlock")
unlock = true;
else if (arg->starts_with("-"))
return false;
args.push_back(*arg);
return true;
}).parseCmdline(Strings(argv + 1, argv + argc));
});
if (unlock)

View file

@ -6,17 +6,16 @@
#include <sys/stat.h>
#include <fcntl.h>
#include "lix/libstore/build-result.hh"
#include "lix/libstore/path.hh"
#include "lix/libstore/serve-protocol-impl.hh"
#include "lix/libstore/serve-protocol.hh"
#include "lix/libstore/ssh.hh"
#include "lix/libutil/current-process.hh"
#include "lix/libutil/finally.hh"
#include "lix/libutil/url.hh"
#include "build-result.hh"
#include "current-process.hh"
#include "path.hh"
#include "serve-protocol.hh"
#include "state.hh"
#include "lix/libstore/temporary-dir.hh"
#include "serve-protocol.hh"
#include "serve-protocol-impl.hh"
#include "ssh.hh"
#include "finally.hh"
#include "url.hh"
using namespace nix;

View file

@ -1,7 +1,7 @@
#include "hydra-build-result.hh"
#include "lix/libstore/fs-accessor.hh"
#include "lix/libstore/store-api.hh"
#include "lix/libutil/strings.hh"
#include "store-api.hh"
#include "fs-accessor.hh"
#include "strings.hh"
#include <regex>

View file

@ -1,10 +1,9 @@
#include <cmath>
#include "hydra-build-result.hh"
#include "lix/libstore/binary-cache-store.hh"
#include "lix/libutil/error.hh"
#include "lix/libutil/finally.hh"
#include "state.hh"
#include "hydra-build-result.hh"
#include "finally.hh"
#include "binary-cache-store.hh"
using namespace nix;
@ -186,7 +185,7 @@ State::StepResult State::doBuildStep(nix::ref<Store> destStore,
unlink(result.logFile.c_str());
}
} catch (...) {
ignoreExceptionInDestructor();
ignoreExceptionExceptInterrupt();
}
}
});

View file

@ -2,9 +2,9 @@
#include <memory>
#include "lix/libstore/derivations.hh"
#include "lix/libstore/store-api.hh"
#include "lix/libutil/hash.hh"
#include "hash.hh"
#include "derivations.hh"
#include "store-api.hh"
#include "nar-extractor.hh"
struct BuildProduct

View file

@ -11,16 +11,15 @@
#include <nlohmann/json.hpp>
#include "hydra-build-result.hh"
#include "lix/libstore/store-api.hh"
#include "lix/libutil/signals.hh"
#include "signals.hh"
#include "state.hh"
#include "hydra-build-result.hh"
#include "store-api.hh"
#include "globals.hh"
#include "hydra-config.hh"
#include "lix/libmain/shared.hh"
#include "lix/libstore/globals.hh"
#include "lix/libstore/s3-binary-cache-store.hh"
#include "lix/libutil/args.hh"
#include "s3-binary-cache-store.hh"
#include "shared.hh"
using namespace nix;
using nlohmann::json;
@ -869,7 +868,7 @@ void State::run(BuildID buildOne)
<< metricsAddr << "/metrics (port " << exposerPort << ")"
<< std::endl;
StoreConfig::Params localParams;
Store::Params localParams;
localParams["max-connections"] = "16";
localParams["max-connection-age"] = "600";
localStore = openStore(getEnv("NIX_REMOTE").value_or(""), localParams);
@ -974,7 +973,7 @@ int main(int argc, char * * argv)
BuildID buildOne = 0;
std::optional<std::string> metricsAddrOpt = std::nullopt;
LegacyArgs(argv[0], [&](Strings::iterator & arg, const Strings::iterator & end) {
parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
if (*arg == "--unlock")
unlock = true;
else if (*arg == "--status")
@ -989,7 +988,7 @@ int main(int argc, char * * argv)
} else
return false;
return true;
}).parseCmdline(Strings(argv + 1, argv + argc));
});
settings.verboseBuild = true;

View file

@ -1,6 +1,6 @@
#include "nar-extractor.hh"
#include "lix/libutil/archive.hh"
#include "archive.hh"
#include <unordered_set>
#include <utility>
@ -9,35 +9,6 @@ using namespace nix;
struct Extractor : NARParseVisitor
{
class MyFileHandle : public FileHandle
{
NarMemberData & memberData;
uint64_t expectedSize;
std::unique_ptr<HashSink> hashSink;
public:
MyFileHandle(NarMemberData & memberData, uint64_t size) : memberData(memberData), expectedSize(size)
{
hashSink = std::make_unique<HashSink>(HashType::SHA256);
}
void receiveContents(std::string_view data) override
{
*memberData.fileSize += data.size();
(*hashSink)(data);
if (memberData.contents) {
memberData.contents->append(data);
}
assert(memberData.fileSize <= expectedSize);
if (memberData.fileSize == expectedSize) {
auto [hash, len] = hashSink->finish();
assert(memberData.fileSize == len);
memberData.sha256 = hash;
hashSink.reset();
}
}
};
std::unordered_set<Path> filesToKeep {
"/nix-support/hydra-build-products",
"/nix-support/hydra-release-name",
@ -58,15 +29,43 @@ struct Extractor : NARParseVisitor
std::unique_ptr<FileHandle> createRegularFile(const Path & path, uint64_t size, bool executable) override
{
auto memberData = &members.insert_or_assign(prefix + path, NarMemberData {
MyFileHandle * hdl = new MyFileHandle();
hdl->memberData = &members.insert_or_assign(prefix + path, NarMemberData {
.type = FSAccessor::Type::tRegular,
.fileSize = 0,
.contents = filesToKeep.count(path) ? std::optional("") : std::nullopt,
}).first->second;
return std::make_unique<MyFileHandle>(*memberData, size);
hdl->expectedSize = size;
hdl->hashSink = std::make_unique<HashSink>(HashType::SHA256);
return std::unique_ptr<MyFileHandle>(hdl);
}
struct MyFileHandle : public FileHandle
{
uint64_t expectedSize;
std::unique_ptr<HashSink> hashSink;
NarMemberData * memberData;
void receiveContents(std::string_view data) override
{
*memberData->fileSize += data.size();
(*hashSink)(data);
if (memberData->contents) {
memberData->contents->append(data);
}
assert(memberData->fileSize <= expectedSize);
if (memberData->fileSize == expectedSize) {
auto [hash, len] = hashSink->finish();
assert(memberData->fileSize == len);
memberData->sha256 = hash;
hashSink.reset();
}
}
};
void createSymlink(const Path & path, const std::string & target) override
{
members.insert_or_assign(prefix + path, NarMemberData { .type = FSAccessor::Type::tSymlink });

View file

@ -1,9 +1,9 @@
#pragma once
#include "lix/libstore/fs-accessor.hh"
#include "lix/libutil/hash.hh"
#include "lix/libutil/serialise.hh"
#include "lix/libutil/types.hh"
#include "fs-accessor.hh"
#include "types.hh"
#include "serialise.hh"
#include "hash.hh"
struct NarMemberData
{

View file

@ -1,7 +1,7 @@
#include "hydra-build-result.hh"
#include "lix/libstore/globals.hh"
#include "lix/libutil/thread-pool.hh"
#include "state.hh"
#include "hydra-build-result.hh"
#include "globals.hh"
#include "thread-pool.hh"
#include <cstring>
#include <utility>
@ -411,7 +411,7 @@ std::map<DrvOutput, std::optional<StorePath>> State::getMissingRemotePaths(
const std::map<DrvOutput, std::optional<StorePath>> & paths)
{
Sync<std::map<DrvOutput, std::optional<StorePath>>> missing_;
ThreadPool tp("hydra-getMissingRemotePaths");
ThreadPool tp;
for (auto & [output, maybeOutputPath] : paths) {
if (!maybeOutputPath) {

View file

@ -16,15 +16,15 @@
#include "db.hh"
#include "lix/libstore/build-result.hh"
#include "lix/libstore/machines.hh"
#include "lix/libstore/parsed-derivations.hh"
#include "lix/libstore/pathlocks.hh"
#include "lix/libstore/serve-protocol.hh"
#include "lix/libstore/store-api.hh"
#include "lix/libutil/pool.hh"
#include "lix/libutil/sync.hh"
#include "parsed-derivations.hh"
#include "pathlocks.hh"
#include "pool.hh"
#include "build-result.hh"
#include "store-api.hh"
#include "sync.hh"
#include "nar-extractor.hh"
#include "serve-protocol.hh"
#include "machines.hh"
using BuildID = unsigned int;

View file

@ -2,8 +2,8 @@
#include <pqxx/pqxx>
#include "lix/libutil/environment-variables.hh"
#include "lix/libutil/strings.hh"
#include "strings.hh"
#include "environment-variables.hh"
struct Connection : pqxx::connection

View file

@ -2,9 +2,9 @@
#include <map>
#include "lix/libutil/environment-variables.hh"
#include "lix/libutil/file-system.hh"
#include "lix/libutil/strings.hh"
#include "environment-variables.hh"
#include "file-system.hh"
#include "strings.hh"
struct HydraConfig
{