MCPcopy Index your code
hub / github.com/jetify-com/devbox / PkgExistsForAnySystem

Function PkgExistsForAnySystem

internal/nix/search.go:63–86  ·  view source on GitHub ↗

PkgExistsForAnySystem is a bit slow (~600ms). Only use it if there's already been an error and we want to provide a better error message.

(pkg string)

Source from the content-addressed store, hash-verified

61// PkgExistsForAnySystem is a bit slow (~600ms). Only use it if there's already
62// been an error and we want to provide a better error message.
63func PkgExistsForAnySystem(pkg string) bool {
64 systems := []string{
65 // Check most common systems first.
66 "x86_64-linux",
67 "x86_64-darwin",
68 "aarch64-linux",
69 "aarch64-darwin",
70
71 "armv5tel-linux",
72 "armv6l-linux",
73 "armv7l-linux",
74 "i686-linux",
75 "mipsel-linux",
76 "powerpc64le-linux",
77 "riscv64-linux",
78 }
79 for _, system := range systems {
80 results, _ := searchSystem(pkg, system)
81 if len(results) > 0 {
82 return true
83 }
84 }
85 return false
86}
87
88func searchSystem(url, system string) (map[string]*PkgInfo, error) {
89 // Eventually we may pass a writer here, but for now it is safe to use stderr

Callers 1

Calls 1

searchSystemFunction · 0.85

Tested by

no test coverage detected