(ctx context.Context, installable string, allowInsecure bool)
| 26 | } |
| 27 | |
| 28 | func 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. |
| 54 | func StorePathsAreInStore(ctx context.Context, storePaths []string) (map[string]bool, error) { |
no test coverage detected