Compare commits

...

4 commits

Author SHA1 Message Date
Pierre Bourdon c057494450
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8' (2024-06-01)
  → 'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7' (2024-07-03)
• Updated input 'lix':
    'f170870ae7.tar.gz?narHash=sha256-GK6PusfbMgkg%2BqdgChmrw78KTNQkm7SDoJ6%2BlJKY6vg%3D' (2024-06-25)
  → 'ef0de7c79f.tar.gz?narHash=sha256-GUH5%2BB1JztzDNSN1D7KbndrYSq0LWvVIJnuWKHlpN3Q%3D' (2024-07-16)
• Updated input 'nix-github-actions':
    'github:nix-community/nix-github-actions/5163432afc817cf8bd1f031418d1869e4c9d5547' (2023-12-29)
  → 'github:nix-community/nix-github-actions/622f829f5fe69310a866c8a6cd07e747c44ef820' (2024-07-04)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/d9e18354acbf59c625505b7315c85508e9831bf4' (2024-06-18)
  → 'github:NixOS/nixpkgs/732b4f3a3afdfe6a6c4fcb2511e529588d4e5ccd' (2024-07-15)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/1cb529bffa880746a1d0ec4e0f5076876af931f1' (2024-06-11)
  → 'github:numtide/treefmt-nix/0fb28f237f83295b4dd05e342f333b447c097398' (2024-07-15)
2024-07-17 07:57:52 +02:00
Pierre Bourdon d9a46559a4
drv: backport CA derivations support changes from hydra-eval-jobs
It is not possible to query output paths for CA derivations since
they're not static / known at eval time. Instead, return JSON nulls for
outputs paths.

This is a partial port of the following Hydra commits:

- 9ba4417940ffdd0fadea43f68c61ef948a4b8d39
- 069b7775c565f5999fe33e8c3f28c7b9306039ca
- fcde5908d8e51f975b883329b34d24a9f30ea4b3

By the following authors:

Co-Authored-By: John Ericson <John.Ericson@Obsidian.Systems>
Co-Authored-By: Théophane Hufschmitt <theophane.hufschmitt@tweag.io>
Co-Authored-By: Alexander Sosedkin <monk@unboiled.info>
Co-Authored-By: Andrea Ciceri <andrea.ciceri@autistici.org>
Co-Authored-By: Charlotte 🦝 Delenk Mlotte@chir.rs>
Co-Authored-By: Sandro Jäckel <sandro.jaeckel@gmail.com>
2024-07-16 09:15:21 +02:00
eldritch horrors f8869bdcca update for lix 2.91-dev
the api of nix::Pid changed, causing a build failure.
2024-06-25 23:57:51 +02:00
jade fd86a1a068 Fix on latest lix
Fixes: #9
2024-06-18 23:08:04 -07:00
7 changed files with 48 additions and 31 deletions

View file

@ -23,11 +23,11 @@
]
},
"locked": {
"lastModified": 1717285511,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
@ -47,15 +47,15 @@
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1718590005,
"narHash": "sha256-fiWc1ZyMlTXXSjcmoEQ+NHhIgtcImPHszbOu5c515cU=",
"rev": "98d0249d5c7f5dcc1d2436c4829f073fca668f80",
"lastModified": 1721094616,
"narHash": "sha256-GUH5+B1JztzDNSN1D7KbndrYSq0LWvVIJnuWKHlpN3Q=",
"rev": "ef0de7c79f3b32f66db447220d26eae7e7c07b19",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/98d0249d5c7f5dcc1d2436c4829f073fca668f80.tar.gz"
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/ef0de7c79f3b32f66db447220d26eae7e7c07b19.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://git.lix.systems/lix-project/lix/archive/release-2.90.tar.gz"
"url": "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"
}
},
"nix-github-actions": {
@ -65,11 +65,11 @@
]
},
"locked": {
"lastModified": 1703863825,
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
"lastModified": 1720066371,
"narHash": "sha256-uPlLYH2S0ACj0IcgaK9Lsf4spmJoGejR9DotXiXSBZQ=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
"rev": "622f829f5fe69310a866c8a6cd07e747c44ef820",
"type": "github"
},
"original": {
@ -96,11 +96,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1718676691,
"narHash": "sha256-DWKbARWtRpT1yiLLm+5vMijx65YB7NwGZMV6NXOtrJ8=",
"lastModified": 1721079475,
"narHash": "sha256-wZ62hFCMTUG68u3hSUSJOCP/ltuE32Yb4dy7FfPCpso=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d9e18354acbf59c625505b7315c85508e9831bf4",
"rev": "732b4f3a3afdfe6a6c4fcb2511e529588d4e5ccd",
"type": "github"
},
"original": {
@ -158,11 +158,11 @@
]
},
"locked": {
"lastModified": 1718139168,
"narHash": "sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k=",
"lastModified": 1721059077,
"narHash": "sha256-gCICMMX7VMSKKt99giDDtRLkHJ0cwSgBtDijJAqTlto=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "1cb529bffa880746a1d0ec4e0f5076876af931f1",
"rev": "0fb28f237f83295b4dd05e342f333b447c097398",
"type": "github"
},
"original": {

View file

@ -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 = "https://git.lix.systems/lix-project/lix/archive/release-2.90.tar.gz";
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};

View file

@ -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
]))

View file

@ -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()) {

View file

@ -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;

View file

@ -93,7 +93,7 @@ struct Proc {
to = std::move(toPipe.writeSide);
from = std::move(fromPipe.readSide);
pid = p;
pid = std::move(p);
}
~Proc() {}

View file

@ -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 {