[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

@@ -91,6 +91,18 @@ All notable changes to cargoxx will be documented in this file.
6 cases against fixtures derived from a real fmt 10.2.1 response;
`tests/devbox_resolve_live.cpp` (gated by `CARGOXX_NETWORK_TESTS=1`)
hits the live API.
- `cargoxx.resolver::nixpkgs_git_resolve(name, version, repo_path?)`
fallback for when search.devbox.sh is unreachable. Lazily clones
`https://github.com/NixOS/nixpkgs.git` into
`$XDG_CACHE_HOME/cargoxx/nixpkgs/` (or `$HOME/.cache/...`) on first
use, then runs
`git -C <repo> log --all -S 'version = "<v>"' --pretty='%H %ct' -- pkgs/`
and returns the youngest matching commit. Pure helper
`pick_youngest_commit(text)` parses the `%H %ct` lines. The unit
test builds a tiny throwaway git fixture that mirrors the
`pkgs/development/libraries/<pkg>/default.nix` layout (avoiding the
real multi-GB clone) and verifies introducing-commit detection plus
the not-found path; 5 cases.
- `cargoxx add <pkg>` now auto-resolves packages outside the curated
linkdb. On `LinkdbUnknownPackage`, `cmd_add` invokes
`resolver::discover` which: probes `nixpkgs#<pkg>` to confirm the