Compare commits
13 commits
own-thread
...
main
Author | SHA1 | Date | |
---|---|---|---|
leo60228 | 912a9d6331 | ||
alois31 | bbbebaf380 | ||
alois31 | b9e0abe9e6 | ||
jade | 57ddb99e78 | ||
jade | 9160d40f80 | ||
Qyriad | 43aaa943bf | ||
Qyriad | 50a1455953 | ||
42a160bce2 | |||
Pierre Bourdon | c057494450 | ||
Pierre Bourdon | d9a46559a4 | ||
eldritch horrors | f8869bdcca | ||
jade | fd86a1a068 | ||
jade | 9c23772cf2 |
54
flake.lock
54
flake.lock
|
@ -23,11 +23,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717285511,
|
||||
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
|
||||
"lastModified": 1730504689,
|
||||
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
|
||||
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -47,17 +47,15 @@
|
|||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718228457,
|
||||
"narHash": "sha256-vGumESUGu/jo2Lm5bha/xBsJKVlb1wuclXlL9xudRp4=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "f46194faa2fc9c78250702c8eb7a4b756e0bd944",
|
||||
"revCount": 15757,
|
||||
"type": "git",
|
||||
"url": "https://git@git.lix.systems/lix-project/lix"
|
||||
"lastModified": 1731683711,
|
||||
"narHash": "sha256-bq21I1EjXJa/s5Rra9J9ot2NkPCnI0F5uNPurwYLdpE=",
|
||||
"rev": "c859d03013712b349d82ee6223948d6d03e63a8d",
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/c859d03013712b349d82ee6223948d6d03e63a8d.tar.gz?rev=c859d03013712b349d82ee6223948d6d03e63a8d"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git@git.lix.systems/lix-project/lix"
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"
|
||||
}
|
||||
},
|
||||
"nix-github-actions": {
|
||||
|
@ -67,11 +65,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703863825,
|
||||
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
|
||||
"lastModified": 1729742964,
|
||||
"narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-github-actions",
|
||||
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
|
||||
"rev": "e04df33f62cdcf93d73e9a04142464753a16db67",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -83,11 +81,11 @@
|
|||
"nix2container": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1712990762,
|
||||
"narHash": "sha256-hO9W3w7NcnYeX8u8cleHiSpK2YJo7ecarFTUlbybl7k=",
|
||||
"lastModified": 1724996935,
|
||||
"narHash": "sha256-njRK9vvZ1JJsP8oV2OgkBrpJhgQezI03S7gzskCcHos=",
|
||||
"owner": "nlewo",
|
||||
"repo": "nix2container",
|
||||
"rev": "20aad300c925639d5d6cbe30013c8357ce9f2a2e",
|
||||
"rev": "fa6bb0a1159f55d071ba99331355955ae30b3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -98,16 +96,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1718132686,
|
||||
"narHash": "sha256-JRinkq+FeAkYnrrK8+Bh+jtLHJBN5jDzSimk1ye00EE=",
|
||||
"lastModified": 1731663789,
|
||||
"narHash": "sha256-x07g4NcqGP6mQn6AISXJaks9sQYDjZmTMBlKIvajvyc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "96b3dae4f8753c1f5ce0d06b57fe250fb5d9b0e0",
|
||||
"rev": "035d434d48f4375ac5d3a620954cf5fda7dd7c36",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11-small",
|
||||
"ref": "nixos-24.05-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -131,11 +129,11 @@
|
|||
"pre-commit-hooks": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1712055707,
|
||||
"narHash": "sha256-4XLvuSIDZJGS17xEwSrNuJLL7UjDYKGJSbK1WWX2AK8=",
|
||||
"lastModified": 1726745158,
|
||||
"narHash": "sha256-D5AegvGoEjt4rkKedmxlSEmC+nNLMBPWFxvmYnVLhjk=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "e35aed5fda3cc79f88ed7f1795021e559582093a",
|
||||
"rev": "4e743a6920eab45e8ba0fbe49dc459f1423a4b74",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -160,11 +158,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718139168,
|
||||
"narHash": "sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k=",
|
||||
"lastModified": 1730321837,
|
||||
"narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "1cb529bffa880746a1d0ec4e0f5076876af931f1",
|
||||
"rev": "746901bb8dba96d154b66492a29f5db0693dbfcc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
description = "Hydra's builtin hydra-eval-jobs as a standalone";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11-small";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05-small";
|
||||
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
inputs.flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
|
@ -9,7 +9,7 @@
|
|||
inputs.nix-github-actions.url = "github:nix-community/nix-github-actions";
|
||||
inputs.nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.lix = {
|
||||
url = "git+https://git@git.lix.systems/lix-project/lix";
|
||||
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
project('nix-eval-jobs', 'cpp',
|
||||
version : '0.1.6',
|
||||
license : 'GPL-3.0',
|
||||
default_options : [
|
||||
'debug=true',
|
||||
'optimization=2',
|
||||
'cpp_std=c++20',
|
||||
],
|
||||
)
|
||||
|
||||
nix_main_dep = dependency('lix-main', required: true)
|
||||
|
|
|
@ -23,6 +23,7 @@ in
|
|||
pkgs.mkShell {
|
||||
inherit (nix-eval-jobs) buildInputs;
|
||||
nativeBuildInputs = nix-eval-jobs.nativeBuildInputs ++ [
|
||||
pkgs.clang-tools
|
||||
(pkgs.python3.withPackages (ps: [
|
||||
ps.pytest
|
||||
]))
|
||||
|
|
33
src/drv.cc
33
src/drv.cc
|
@ -23,14 +23,17 @@
|
|||
#include "drv.hh"
|
||||
#include "eval-args.hh"
|
||||
|
||||
static bool queryIsCached(nix::Store &store,
|
||||
std::map<std::string, std::string> &outputs) {
|
||||
static bool
|
||||
queryIsCached(nix::Store &store,
|
||||
std::map<std::string, std::optional<std::string>> &outputs) {
|
||||
uint64_t downloadSize, narSize;
|
||||
nix::StorePathSet willBuild, willSubstitute, unknown;
|
||||
|
||||
std::vector<nix::StorePathWithOutputs> paths;
|
||||
for (auto const &[key, val] : outputs) {
|
||||
paths.push_back(followLinksToStorePathWithOutputs(store, val));
|
||||
if (val) {
|
||||
paths.push_back(followLinksToStorePathWithOutputs(store, *val));
|
||||
}
|
||||
}
|
||||
|
||||
store.queryMissing(toDerivedPaths(paths), willBuild, willSubstitute,
|
||||
|
@ -45,9 +48,19 @@ Drv::Drv(std::string &attrPath, nix::EvalState &state, nix::DrvInfo &drvInfo,
|
|||
auto localStore = state.store.dynamic_pointer_cast<nix::LocalFSStore>();
|
||||
|
||||
try {
|
||||
for (auto out : drvInfo.queryOutputs(true)) {
|
||||
if (out.second)
|
||||
outputs[out.first] = localStore->printStorePath(*out.second);
|
||||
// CA derivations do not have static output paths, so we have to
|
||||
// defensively not query output paths in case we encounter one.
|
||||
for (auto &[outputName, optOutputPath] :
|
||||
drvInfo.queryOutputs(!nix::experimentalFeatureSettings.isEnabled(
|
||||
nix::Xp::CaDerivations))) {
|
||||
if (optOutputPath) {
|
||||
outputs[outputName] =
|
||||
localStore->printStorePath(*optOutputPath);
|
||||
} else {
|
||||
assert(nix::experimentalFeatureSettings.isEnabled(
|
||||
nix::Xp::CaDerivations));
|
||||
outputs[outputName] = std::nullopt;
|
||||
}
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
throw nix::EvalError(state,
|
||||
|
@ -98,10 +111,16 @@ Drv::Drv(std::string &attrPath, nix::EvalState &state, nix::DrvInfo &drvInfo,
|
|||
}
|
||||
|
||||
void to_json(nlohmann::json &json, const Drv &drv) {
|
||||
std::map<std::string, nlohmann::json> outputsJson;
|
||||
for (auto &[name, optPath] : drv.outputs) {
|
||||
outputsJson[name] =
|
||||
optPath ? nlohmann::json(*optPath) : nlohmann::json(nullptr);
|
||||
}
|
||||
|
||||
json = nlohmann::json{{"name", drv.name},
|
||||
{"system", drv.system},
|
||||
{"drvPath", drv.drvPath},
|
||||
{"outputs", drv.outputs},
|
||||
{"outputs", outputsJson},
|
||||
{"inputDrvs", drv.inputDrvs}};
|
||||
|
||||
if (drv.meta.has_value()) {
|
||||
|
|
|
@ -24,7 +24,7 @@ struct Drv {
|
|||
std::string drvPath;
|
||||
|
||||
enum class CacheStatus { Cached, Uncached, Unknown } cacheStatus;
|
||||
std::map<std::string, std::string> outputs;
|
||||
std::map<std::string, std::optional<std::string>> outputs;
|
||||
std::map<std::string, std::set<std::string>> inputDrvs;
|
||||
std::optional<nlohmann::json> meta;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
src = [
|
||||
src = files(
|
||||
'nix-eval-jobs.cc',
|
||||
'eval-args.cc',
|
||||
'drv.cc',
|
||||
'buffered-io.cc',
|
||||
'worker.cc'
|
||||
]
|
||||
'worker.cc',
|
||||
)
|
||||
|
||||
cc = meson.get_compiler('cpp')
|
||||
|
||||
|
@ -31,4 +31,4 @@ executable('nix-eval-jobs', src,
|
|||
threads_dep
|
||||
],
|
||||
install: true,
|
||||
cpp_args: ['-std=c++2a', '--include', 'autotools-config.h'])
|
||||
cpp_args: ['--include', 'autotools-config.h'])
|
||||
|
|
|
@ -93,7 +93,7 @@ struct Proc {
|
|||
|
||||
to = std::move(toPipe.writeSide);
|
||||
from = std::move(fromPipe.readSide);
|
||||
pid = p;
|
||||
pid = std::move(p);
|
||||
}
|
||||
|
||||
~Proc() {}
|
||||
|
@ -344,24 +344,16 @@ int main(int argc, char **argv) {
|
|||
|
||||
return handleExceptions(argv[0], [&]() {
|
||||
initNix();
|
||||
initGC();
|
||||
initLibExpr();
|
||||
|
||||
myArgs.parseArgs(argv, argc);
|
||||
|
||||
/* FIXME: The build hook in conjunction with import-from-derivation is
|
||||
* causing "unexpected EOF" during eval */
|
||||
settings.builders = "";
|
||||
|
||||
/* Prevent access to paths outside of the Nix search path and
|
||||
to the environment. */
|
||||
evalSettings.restrictEval = false;
|
||||
|
||||
/* When building a flake, use pure evaluation (no access to
|
||||
'getEnv', 'currentSystem' etc. */
|
||||
if (myArgs.impure) {
|
||||
evalSettings.pureEval = false;
|
||||
evalSettings.pureEval.override(false);
|
||||
} else if (myArgs.flake) {
|
||||
evalSettings.pureEval = true;
|
||||
evalSettings.pureEval.override(true);
|
||||
}
|
||||
|
||||
if (myArgs.releaseExpr == "")
|
||||
|
@ -374,7 +366,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
if (myArgs.showTrace) {
|
||||
loggerSettings.showTrace.assign(true);
|
||||
loggerSettings.showTrace.override(true);
|
||||
}
|
||||
|
||||
Sync<State> state_;
|
||||
|
|
|
@ -30,15 +30,12 @@
|
|||
#include <lix/libexpr/value.hh>
|
||||
#include <lix/libutil/terminal.hh>
|
||||
#include <exception>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "worker.hh"
|
||||
#include "drv.hh"
|
||||
|
@ -51,7 +48,7 @@ static nix::Value *releaseExprTopLevelValue(nix::EvalState &state,
|
|||
nix::Value vTop;
|
||||
|
||||
if (args.fromArgs) {
|
||||
nix::Expr *e = state.parseExprFromString(
|
||||
nix::Expr &e = state.parseExprFromString(
|
||||
args.releaseExpr, state.rootPath(nix::CanonPath::fromCwd()));
|
||||
state.eval(e, vTop);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue