2023-08-17 02:51:18 +00:00
|
|
|
package nixdrv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
2023-08-23 23:00:44 +00:00
|
|
|
"context"
|
2023-08-17 02:51:18 +00:00
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
type LocalFSResolver struct{}
|
|
|
|
|
2023-08-23 23:00:44 +00:00
|
|
|
func (LocalFSResolver) LoadDerivation(ctx context.Context, path string) (*Derivation, error) {
|
2023-08-17 02:51:18 +00:00
|
|
|
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
|
|
|
|
}
|