1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 02:43:54 +02: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:
Robert Hensing 2024-07-08 14:36:36 +02:00 committed by GitHub
parent d8850618b6
commit cfe3ee3de8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 198 additions and 29 deletions

View file

@ -26,6 +26,9 @@ let pkgs = rec {
fun() {
echo blabla
}
runHook() {
eval "''${!1}"
}
'';
stdenv = mkDerivation {
@ -45,6 +48,18 @@ let pkgs = rec {
TEST_inNixShell = if inNixShell then "true" else "false";
inherit stdenv;
outputs = ["dev" "out"];
} // {
shellHook = abort "Ignore non-drv shellHook attr";
};
# https://github.com/NixOS/nix/issues/5431
# See nix-shell.sh
polo = mkDerivation {
name = "polo";
inherit stdenv;
shellHook = ''
echo Polo
'';
};
# Used by nix-shell -p