cmd/nix-tool/resolve: build before evaluate

This avoids many problems that come up when resolving on an empty store. All paths are built later on anyway.
This commit is contained in:
Ophestra 2025-07-20 02:14:22 +09:00
parent 3deb8862ba
commit 0956524d0c
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -13,6 +13,11 @@ func buildAndResolve(ctx nix.Context, name string, installable *string, collecti
return err
}
log.Printf("building %q...", *installable)
if err := nix.Build(ctx, slices.Values([]string{*installable})); err != nil {
return commandHandlerError(fmt.Sprintf("cannot build: %v", err))
}
log.Printf("evaluating %q...", *installable)
var installables []string
if v, err := nix.EvalInstantiated(ctx, *installable); err != nil {