[M5+] use devbox attr_paths for pinned-dep nixpkgs attr

This commit is contained in:
2026-05-10 13:06:35 +00:00
parent 935e8d5f79
commit 1604b1d5a8
6 changed files with 86 additions and 27 deletions

View File

@@ -174,15 +174,25 @@ auto nixpkgs_git_resolve(const std::string& name, const std::string& version,
std::optional<std::filesystem::path> repo_path = std::nullopt)
-> util::Result<std::string>;
// What `resolve_version` returns: a nixpkgs commit and the attribute
// path under which the package lives at that commit. The attr is
// authoritative *for that rev* — the cargoxx-curated linkdb attrs
// (e.g. `fmt_10`) only apply to the unpinned `nixos-unstable` set.
// When devbox supplies multiple attr paths the first is canonical.
struct ResolvedVersion {
std::string nixpkgs_rev;
std::string nixpkgs_attr;
};
// Top-level orchestrator: try `devbox_resolve` first, then
// `nixpkgs_git_resolve` as fallback. Returns a 40-char nixpkgs SHA, or
// `nixpkgs_git_resolve` as fallback. Returns the rev + attr or
// `ResolutionVersionNotFound` when both probes come back empty.
//
// Use this from `cargoxx add <pkg>@<concrete-ver>` to capture the rev
// that lockfile/codegen will pin. Wildcards (`*`, empty) should NOT be
// passed — they are not concrete versions and the resolver returns
// `ResolutionVersionNotFound` for them by design.
// Use this from `cargoxx add <pkg>@<concrete-ver>` to capture the pin
// that lockfile/codegen will use. Wildcards (`*`, empty) should NOT
// be passed — they are not concrete versions and the resolver
// returns `ResolutionVersionNotFound` for them by design.
auto resolve_version(const std::string& name, const std::string& version)
-> util::Result<std::string>;
-> util::Result<ResolvedVersion>;
} // namespace cargoxx::resolver