23 lines
679 B
Go
23 lines
679 B
Go
package nixbuild
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"iter"
|
|
"os/exec"
|
|
)
|
|
|
|
// Context holds configuration and environment information for interacting with nix.
|
|
type Context interface {
|
|
// Streams returns the stdout and stderr writers held by this [Context].
|
|
Streams() (stdout, stderr io.Writer)
|
|
|
|
// Nix returns the [exec.Cmd] struct to execute a nix command.
|
|
Nix(ctx context.Context, arg ...string) *exec.Cmd
|
|
// WriteStdin calls [WriteStdin] for [exec.Cmd]. The function f points to is called if [WriteStdin] succeeds.
|
|
WriteStdin(cmd *exec.Cmd, installables iter.Seq[string], f func() error) (int, error)
|
|
|
|
// Unwrap returns the stored [context.Context]
|
|
Unwrap() context.Context
|
|
}
|