I’m currently developing a project and I wrote a shell.nix
. I have a script to build the project. Now I found some inconsistent behavior with nix-shell. I use cmake
to build all code. if I do
$ nix-shell
$ ./build.sh
it works fine. If I instead use this script:
#!/usr/bin/env nix-shell
#!nix-shell shell.nix
#!nix-shell -i "zsh"
# same content in ./build.sh
still works fine, but it will cause additional outputs(some -Wmaybe-uninitialized
warnings)
I checked the env
command and notice that the stdenv
variable is different in the two cases. The shell.nix
import a pinned nixpkgs
but it’s currently the same with the global one. So what cause this? It’s not necessary an issue but it introduces some inconsistency (from my point-of-view).