nixbuild/sign.go
Ophestra a3427ce7dd
context: interface command type
This should allow caller to override the method to run in a container.
2025-09-13 13:06:39 +09:00

24 lines
532 B
Go

package nix
import (
"context"
"iter"
)
// Sign recursively signs installables using the key at keyPath.
func Sign(ctx Context, keyPath string, installables iter.Seq[string]) error {
c, cancel := context.WithCancel(ctx.Unwrap())
defer cancel()
cmd := ctx.Nix(c, CommandStore, CommandStoreSign,
FlagPrintBuildLogs, FlagVerbose,
// this is quite useless if not signing recursively
FlagRecursive,
FlagKeyFile, keyPath,
FlagStdin)
setStreams(ctx, cmd)
_, err := ctx.WriteStdin(cmd, installables, nil)
return err
}