depot/go/nix/nixdrv/localfs.go

24 lines
368 B
Go

package nixdrv
import (
"bufio"
"context"
"os"
)
type LocalFSResolver struct{}
func (LocalFSResolver) LoadDerivation(ctx context.Context, path string) (*Derivation, error) {
f, err := os.Open(path)
if err != nil {
return nil, err
}
defer f.Close()
bio := bufio.NewReader(f)
drv, err := Load(bio)
if err != nil {
return nil, err
}
return drv, nil
}