mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-09 15:58:05 +02:00
Fix 'nix-instantiate --find-file' and add a test
Reported by @lheckemann.
This commit is contained in:
parent
511590976c
commit
12dd8d49c6
2 changed files with 7 additions and 1 deletions
|
@ -169,7 +169,10 @@ static int main_nix_instantiate(int argc, char * * argv)
|
|||
if (findFile) {
|
||||
for (auto & i : files) {
|
||||
auto p = state->findFile(i);
|
||||
std::cout << p.readFile() << std::endl;
|
||||
if (auto fn = p.getPhysicalPath())
|
||||
std::cout << fn->abs() << std::endl;
|
||||
else
|
||||
throw Error("'%s' has no physical path", p);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -9,3 +9,6 @@ nix-instantiate --eval -E '<by-relative-path/simple.nix>' --restrict-eval
|
|||
|
||||
# Should ideally also test this, but there’s no pure way to do it, so just trust me that it works
|
||||
# nix-instantiate --eval -E '<nixpkgs>' -I nixpkgs=channel:nixos-unstable --restrict-eval
|
||||
|
||||
[[ $(nix-instantiate --find-file by-absolute-path/simple.nix) = $PWD/simple.nix ]]
|
||||
[[ $(nix-instantiate --find-file by-relative-path/simple.nix) = $PWD/simple.nix ]]
|
||||
|
|
Loading…
Reference in a new issue