Nix-shell is throwing an error

Running the c shows me this error and I am struggling to find a way to fix it.

warning: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at **(string)** :1:9; will use bash from your environment
bash: ${role_pre}${cmd^^}=${cmd}: bad substitution

Any idea how to fix this?

Hi @tats_sato, don’t know and difficult for me to reproduce without mac, but I found this exact problem with hc and MacOS:

Hope it helps!

1 Like

Hi @guillemcordoba!

Thank you for sharing that article!
I’ve tried the solution recommended there but it didn’t quite work as well…

I reinstalled nix again just to see if it will work but to no avail.
I will try using my PC first for hc dev :smiley:

Thank you!

1 Like

this bit is saying that nix doesn’t have any upstream packages to work with at the moment you drop into the shell

see this Ubuntu and debian troubleshooting brain dump

you can try this:

export NIX_PATH=nixpkgs=nixpkgs=channel:nixos-19.03
nix-channel --update

bash: ${role_pre}${cmd^^}=${cmd}: bad substitution

this bit looks like it is coming from your host system somehow because nix is running whatever bash it found, rather than the one it would normally want to use from its upstream packages (see above)

Hi david!

Thank you for your help!!

I wasnt able to fix this one

export NIX_PATH=nixpkgs=nixpkgs=channel:nixos-19.03
nix-channel --update

with the solution you offered sadly.

HOWEVER, I was able to fix the “bas substitution” problem with this solution.

My nix shell is working now! Amazing thank you so much :sob:

@tats_sato geez, it looks like we could fix this by shipping bashInteractive and setting NIX_BUILD_SHELL in the nix shell

solving the problem with homebrew is fine for you locally but is not a good solution generally because the whole point of nix is to try and avoid manual steps in the environment setup :slight_smile:

if you have the bandwidth for it, that would be a good experiment if you can reproduce the issue, we can put a PR up on holonix