lookPath is like [exec.lookPath], but first checks if there's an environment variable with the name prog. If there is, it returns $prog/bin/prog instead of consulting PATH. For example, lookPath would be able to find bash and patchelf in the following derivation: derivation { inherit (nixpkgs.
(prog string)
| 450 | // builder = devbox; |
| 451 | // } |
| 452 | func lookPath(prog string) string { |
| 453 | pkgPath := os.Getenv(prog) |
| 454 | if pkgPath == "" { |
| 455 | return prog |
| 456 | } |
| 457 | return filepath.Join(pkgPath, "bin", prog) |
| 458 | } |
| 459 | |
| 460 | func isExecutable(mode fs.FileMode) bool { return mode&0o111 != 0 } |
| 461 | func isSymlink(mode fs.FileMode) bool { return mode&fs.ModeSymlink != 0 } |