mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 12:06:01 +01:00
nix-shell: look up shell.nix when argument is a directory (#11057)
* Refactor: rename runEnv -> isNixShell * Refactor: rename left -> remainingArgs * nix-build.cc: Refactor: extract baseDir variable * nix-build.cc: Refactor: extract sourcePath, resolvedPath variables * nix-shell: Look for shell.nix when directory is specified * Add legacy setting: nix-shell-always-looks-for-shell-nix * rl-next: Add note about shell.nix lookups * tests/functional/shell.nix: Implement runHook for dummy stdenv
This commit is contained in:
parent
d8850618b6
commit
cfe3ee3de8
10 changed files with 198 additions and 29 deletions
|
|
@ -2650,7 +2650,7 @@ void EvalState::printStatistics()
|
|||
}
|
||||
|
||||
|
||||
SourcePath resolveExprPath(SourcePath path)
|
||||
SourcePath resolveExprPath(SourcePath path, bool addDefaultNix)
|
||||
{
|
||||
unsigned int followCount = 0, maxFollow = 1024;
|
||||
|
||||
|
|
@ -2666,7 +2666,7 @@ SourcePath resolveExprPath(SourcePath path)
|
|||
}
|
||||
|
||||
/* If `path' refers to a directory, append `/default.nix'. */
|
||||
if (path.resolveSymlinks().lstat().type == SourceAccessor::tDirectory)
|
||||
if (addDefaultNix && path.resolveSymlinks().lstat().type == SourceAccessor::tDirectory)
|
||||
return path / "default.nix";
|
||||
|
||||
return path;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue