[M6] populate Cargoxx.toml; add 'cargoxx linkdb add' CLI; codegen fixes for self-host

This commit is contained in:
2026-05-14 00:17:56 +00:00
parent a757149f99
commit 4f9b6f1827
8 changed files with 104 additions and 14 deletions

View File

@@ -59,25 +59,24 @@ auto find_lockfile_ref(const lockfile::Lockfile& lock, const std::string& name,
auto build_bindings(const GenerateInputs& in) -> std::vector<DepBinding> {
std::vector<DepBinding> out;
out.reserve(in.manifest.dependencies.size());
for (std::size_t i = 0; i < in.manifest.dependencies.size(); ++i) {
const auto& dep = in.manifest.dependencies[i];
const auto& rec = in.recipes[i];
out.reserve(in.manifest.dependencies.size() + in.manifest.dev_dependencies.size());
auto push = [&](const manifest::Dependency& dep, const linkdb::Recipe& rec) {
auto ref = find_lockfile_ref(in.lock, dep.name, dep.version_spec);
// For pinned deps the lockfile's nixpkgs_attr is authoritative
// (it came from devbox's attr_paths for this specific rev). The
// curated recipe's attr only applies to nixos-unstable, so it's
// wrong when the dep pulls from a different rev.
std::string attr = (ref.attr && !ref.attr->empty()) ? *ref.attr
: rec.nixpkgs_attr;
DepBinding b{
out.push_back(DepBinding{
.name = dep.name,
.version = dep.version_spec,
.nixpkgs_attr = std::move(attr),
.sanitized = sanitize_input_attr(dep.name, dep.version_spec),
.rev = std::move(ref.rev),
};
out.push_back(std::move(b));
});
};
for (std::size_t i = 0; i < in.manifest.dependencies.size(); ++i) {
push(in.manifest.dependencies[i], in.recipes[i]);
}
for (std::size_t i = 0; i < in.manifest.dev_dependencies.size(); ++i) {
push(in.manifest.dev_dependencies[i], in.dev_recipes[i]);
}
return out;
}