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

Function StorePathsFromInstallable

internal/nix/store.go:28–51  ·  view source on GitHub ↗
(ctx context.Context, installable string, allowInsecure bool)

Source from the content-addressed store, hash-verified

26}
27
28func StorePathsFromInstallable(ctx context.Context, installable string, allowInsecure bool) ([]string, error) {
29 defer debug.FunctionTimer().End()
30
31 // --impure for NIXPKGS_ALLOW_UNFREE
32 cmd := Command("path-info", FixInstallableArg(installable), "--json", "--impure")
33 cmd.Env = allowUnfreeEnv(os.Environ())
34
35 if allowInsecure {
36 slog.Debug("Setting Allow-insecure env-var\n")
37 cmd.Env = allowInsecureEnv(cmd.Env)
38 }
39
40 resultBytes, err := cmd.Output(ctx)
41 if err != nil {
42 return nil, err
43 }
44
45 paths, err := parseStorePathFromInstallableOutput(resultBytes)
46 if err != nil {
47 return nil, fmt.Errorf("failed to parse path-info for %s: %w", installable, err)
48 }
49
50 return maps.Keys(paths), nil
51}
52
53// StorePathsAreInStore a map of store paths to whether they are in the store.
54func StorePathsAreInStore(ctx context.Context, storePaths []string) (map[string]bool, error) {

Callers 2

GetStorePathsMethod · 0.92
FixMissingStorePathsMethod · 0.92

Calls 8

FunctionTimerFunction · 0.92
FixInstallableArgFunction · 0.85
allowUnfreeEnvFunction · 0.85
allowInsecureEnvFunction · 0.85
EndMethod · 0.80
CommandFunction · 0.70
OutputMethod · 0.45

Tested by

no test coverage detected