I’m running Nix 2.22.1 on macOS using home-manager and flakes, so no nix-channels.
I wrote a minimal shell.nix
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05";
pkgs = import nixpkgs { config = { }; overlays = [ ]; };
in
pkgs.mkShellNoCC { }
which fails to build when running nix-shell
:
$ nix-shell
error:
… while calling the 'import' builtin
at «string»:1:2:
1| (import <nixpkgs> {}).bashInteractive
| ^
… while realising the context of a path
… while calling the 'findFile' builtin
at «string»:1:9:
1| (import <nixpkgs> {}).bashInteractive
| ^
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
will use bash from your environment
Detected Bash version that isn't supported by Nixpkgs (3.2.57(1)-release)
Please install Bash 4 or greater to continue.
I suppose that mkShell
runs findFile which depends on <nixpkgs>
. I didn’t have this problem with a mkDerivation
. How can I resolve it?