[M5+] add resolver::nixpkgs_git_resolve fallback

This commit is contained in:
2026-05-10 12:19:25 +00:00
parent df2c25b559
commit cb82e918d8
7 changed files with 622 additions and 0 deletions

View File

@@ -158,4 +158,20 @@ auto parse_devbox_resolve(std::string_view json)
auto devbox_resolve(const std::string& name, const std::string& version)
-> util::Result<DevboxResolution>;
// Pure: parse the output of
// git log --all -S 'version = "<v>"' --pretty='%H %ct' -- pkgs/
// (one commit per line: "<40-char-sha> <unix-epoch-seconds>") and
// return the youngest matching SHA, or nullopt on empty input.
auto pick_youngest_commit(std::string_view git_log_output)
-> std::optional<std::string>;
// Searches a local nixpkgs clone for the youngest commit that
// introduced `version = "<version>"` under pkgs/. `repo_path`
// defaults to ~/.cache/cargoxx/nixpkgs/ — when the directory doesn't
// exist the repo is cloned lazily (multi-GB, only on first miss).
// 404-equivalent: ResolutionVersionNotFound.
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>;
} // namespace cargoxx::resolver