depot/go/nix/nixdrv/localfs.go

25 lines
368 B
Go
Raw Normal View History

package nixdrv
import (
"bufio"
2023-08-23 23:00:44 +00:00
"context"
"os"
)
type LocalFSResolver struct{}
2023-08-23 23:00:44 +00:00
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
}