Compare commits
5 commits
release-2.
...
main
Author | SHA1 | Date | |
---|---|---|---|
42a160bce2 | |||
Pierre Bourdon | c057494450 | ||
Pierre Bourdon | d9a46559a4 | ||
eldritch horrors | f8869bdcca | ||
jade | fd86a1a068 |
46
flake.lock
46
flake.lock
|
@ -23,11 +23,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717285511,
|
"lastModified": 1722555600,
|
||||||
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
|
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
|
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -47,15 +47,15 @@
|
||||||
"pre-commit-hooks": "pre-commit-hooks"
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1718590005,
|
"lastModified": 1723577950,
|
||||||
"narHash": "sha256-fiWc1ZyMlTXXSjcmoEQ+NHhIgtcImPHszbOu5c515cU=",
|
"narHash": "sha256-kOpGI9WPmte1L4QWHviuXsr8jxmGn27zwi82jtzYObM=",
|
||||||
"rev": "98d0249d5c7f5dcc1d2436c4829f073fca668f80",
|
"rev": "b016eb0895bb6714a4f6530d9a2bb6577ac6c3cf",
|
||||||
"type": "tarball",
|
"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/b016eb0895bb6714a4f6530d9a2bb6577ac6c3cf.tar.gz?rev=b016eb0895bb6714a4f6530d9a2bb6577ac6c3cf"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"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": {
|
"nix-github-actions": {
|
||||||
|
@ -65,11 +65,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703863825,
|
"lastModified": 1720066371,
|
||||||
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
|
"narHash": "sha256-uPlLYH2S0ACj0IcgaK9Lsf4spmJoGejR9DotXiXSBZQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-github-actions",
|
"repo": "nix-github-actions",
|
||||||
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
|
"rev": "622f829f5fe69310a866c8a6cd07e747c44ef820",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -81,11 +81,11 @@
|
||||||
"nix2container": {
|
"nix2container": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712990762,
|
"lastModified": 1720642556,
|
||||||
"narHash": "sha256-hO9W3w7NcnYeX8u8cleHiSpK2YJo7ecarFTUlbybl7k=",
|
"narHash": "sha256-qsnqk13UmREKmRT7c8hEnz26X3GFFyIQrqx4EaRc1Is=",
|
||||||
"owner": "nlewo",
|
"owner": "nlewo",
|
||||||
"repo": "nix2container",
|
"repo": "nix2container",
|
||||||
"rev": "20aad300c925639d5d6cbe30013c8357ce9f2a2e",
|
"rev": "3853e5caf9ad24103b13aa6e0e8bcebb47649fe4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -96,11 +96,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1718676691,
|
"lastModified": 1723540975,
|
||||||
"narHash": "sha256-DWKbARWtRpT1yiLLm+5vMijx65YB7NwGZMV6NXOtrJ8=",
|
"narHash": "sha256-rxpxOz2VSqgmwI7g7FGVAoye5bxwO1MSpnELY5bsITw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d9e18354acbf59c625505b7315c85508e9831bf4",
|
"rev": "fb81cec9eda2a6b5365ad723995f0329d9e356fd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -129,11 +129,11 @@
|
||||||
"pre-commit-hooks": {
|
"pre-commit-hooks": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712055707,
|
"lastModified": 1721042469,
|
||||||
"narHash": "sha256-4XLvuSIDZJGS17xEwSrNuJLL7UjDYKGJSbK1WWX2AK8=",
|
"narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "git-hooks.nix",
|
"repo": "git-hooks.nix",
|
||||||
"rev": "e35aed5fda3cc79f88ed7f1795021e559582093a",
|
"rev": "f451c19376071a90d8c58ab1a953c6e9840527fd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -158,11 +158,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1718139168,
|
"lastModified": 1723454642,
|
||||||
"narHash": "sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k=",
|
"narHash": "sha256-S0Gvsenh0II7EAaoc9158ZB4vYyuycvMGKGxIbERNAM=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "treefmt-nix",
|
"repo": "treefmt-nix",
|
||||||
"rev": "1cb529bffa880746a1d0ec4e0f5076876af931f1",
|
"rev": "349de7bc435bdff37785c2466f054ed1766173be",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
inputs.nix-github-actions.url = "github:nix-community/nix-github-actions";
|
inputs.nix-github-actions.url = "github:nix-community/nix-github-actions";
|
||||||
inputs.nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
inputs.lix = {
|
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";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
inherit (nix-eval-jobs) buildInputs;
|
inherit (nix-eval-jobs) buildInputs;
|
||||||
nativeBuildInputs = nix-eval-jobs.nativeBuildInputs ++ [
|
nativeBuildInputs = nix-eval-jobs.nativeBuildInputs ++ [
|
||||||
|
pkgs.clang-tools
|
||||||
(pkgs.python3.withPackages (ps: [
|
(pkgs.python3.withPackages (ps: [
|
||||||
ps.pytest
|
ps.pytest
|
||||||
]))
|
]))
|
||||||
|
|
33
src/drv.cc
33
src/drv.cc
|
@ -23,14 +23,17 @@
|
||||||
#include "drv.hh"
|
#include "drv.hh"
|
||||||
#include "eval-args.hh"
|
#include "eval-args.hh"
|
||||||
|
|
||||||
static bool queryIsCached(nix::Store &store,
|
static bool
|
||||||
std::map<std::string, std::string> &outputs) {
|
queryIsCached(nix::Store &store,
|
||||||
|
std::map<std::string, std::optional<std::string>> &outputs) {
|
||||||
uint64_t downloadSize, narSize;
|
uint64_t downloadSize, narSize;
|
||||||
nix::StorePathSet willBuild, willSubstitute, unknown;
|
nix::StorePathSet willBuild, willSubstitute, unknown;
|
||||||
|
|
||||||
std::vector<nix::StorePathWithOutputs> paths;
|
std::vector<nix::StorePathWithOutputs> paths;
|
||||||
for (auto const &[key, val] : outputs) {
|
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,
|
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>();
|
auto localStore = state.store.dynamic_pointer_cast<nix::LocalFSStore>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (auto out : drvInfo.queryOutputs(true)) {
|
// CA derivations do not have static output paths, so we have to
|
||||||
if (out.second)
|
// defensively not query output paths in case we encounter one.
|
||||||
outputs[out.first] = localStore->printStorePath(*out.second);
|
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) {
|
} catch (const std::exception &e) {
|
||||||
throw nix::EvalError(state,
|
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) {
|
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},
|
json = nlohmann::json{{"name", drv.name},
|
||||||
{"system", drv.system},
|
{"system", drv.system},
|
||||||
{"drvPath", drv.drvPath},
|
{"drvPath", drv.drvPath},
|
||||||
{"outputs", drv.outputs},
|
{"outputs", outputsJson},
|
||||||
{"inputDrvs", drv.inputDrvs}};
|
{"inputDrvs", drv.inputDrvs}};
|
||||||
|
|
||||||
if (drv.meta.has_value()) {
|
if (drv.meta.has_value()) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct Drv {
|
||||||
std::string drvPath;
|
std::string drvPath;
|
||||||
|
|
||||||
enum class CacheStatus { Cached, Uncached, Unknown } cacheStatus;
|
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::map<std::string, std::set<std::string>> inputDrvs;
|
||||||
std::optional<nlohmann::json> meta;
|
std::optional<nlohmann::json> meta;
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ struct Proc {
|
||||||
|
|
||||||
to = std::move(toPipe.writeSide);
|
to = std::move(toPipe.writeSide);
|
||||||
from = std::move(fromPipe.readSide);
|
from = std::move(fromPipe.readSide);
|
||||||
pid = p;
|
pid = std::move(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
~Proc() {}
|
~Proc() {}
|
||||||
|
|
|
@ -30,15 +30,12 @@
|
||||||
#include <lix/libexpr/value.hh>
|
#include <lix/libexpr/value.hh>
|
||||||
#include <lix/libutil/terminal.hh>
|
#include <lix/libutil/terminal.hh>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "worker.hh"
|
#include "worker.hh"
|
||||||
#include "drv.hh"
|
#include "drv.hh"
|
||||||
|
@ -51,7 +48,7 @@ static nix::Value *releaseExprTopLevelValue(nix::EvalState &state,
|
||||||
nix::Value vTop;
|
nix::Value vTop;
|
||||||
|
|
||||||
if (args.fromArgs) {
|
if (args.fromArgs) {
|
||||||
nix::Expr *e = state.parseExprFromString(
|
nix::Expr &e = state.parseExprFromString(
|
||||||
args.releaseExpr, state.rootPath(nix::CanonPath::fromCwd()));
|
args.releaseExpr, state.rootPath(nix::CanonPath::fromCwd()));
|
||||||
state.eval(e, vTop);
|
state.eval(e, vTop);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue