instantiated: connect stdout

This commit is contained in:
Ophestra 2025-07-14 04:12:30 +09:00
parent 2b5a2f26db
commit 826860697d
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -11,6 +11,10 @@ import (
"strings"
)
var (
Stdout io.Writer = nil
)
const (
instantiatedPrefix = "instantiated '"
instantiatedSeparator = " -> "
@ -104,6 +108,8 @@ func EvalInstantiated(ctx context.Context, installable string) ([]string, error)
cmd := exec.CommandContext(c,
"nix", "build", installable,
// since flakes are supposedly experimental
"--extra-experimental-features", "nix-command flakes",
// 'instantiated' messages are only emitted when actually evaluating something
"--option", "eval-cache", "false",
// do not actually build anything
@ -112,6 +118,7 @@ func EvalInstantiated(ctx context.Context, installable string) ([]string, error)
"-Lvvv",
)
cmd.Stdout = Stdout
stderr, err := cmd.StderrPipe()
if err != nil {
return nil, err