instantiated: connect stdout

This commit is contained in:
Yonah 2025-07-14 04:12:30 +09:00
parent 1f01e82714
commit 8c390f6745
Signed by: yonah
SSH Key Fingerprint: SHA256:vnQvK8+XXH9Tbni2AV1a/8qdVK/zPcXw52GM0ruQvwA

View File

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