Header file not found in nix-shell

I’m making my first steps in nix-shell, trying to build some software.

I added ncurses.dev to the derivation:

with (import <nixpkgs> {});
derivation {
  name = "badgeteam.firmware";
  builder = "${bash}/bin/bash";
  args = [ ./builder.sh ];
  setup = ./setup.sh;
  system = builtins.currentSystem;

  baseInputs = [ unzip gnutar coreutils bash gnumake git python gcc gnused binutils-unwrapped ncurses.dev which ];
}

But when I run the build.sh inside the shell it still can’t find it:

[nix-shell:~/dev/ESP32-platform-firmware]$ ./build.sh
make[1]: Entering directory '/home/aengelen/dev/ESP32-platform-firmware/esp-idf/tools/kconfig'
cc -c  -DCURSES_LOC="<curses.h>" -DLOCALE -MD  /home/aengelen/dev/ESP32-platform-firmware/esp-idf/tools/kconfig/mconf.c -o mconf.o
<command-line>: fatal error: curses.h: No such file or directory
compilation terminated.
make[1]: *** [Makefile:171: mconf.o] Error 1
make[1]: Leaving directory '/home/aengelen/dev/ESP32-platform-firmware/esp-idf/tools/kconfig'
make: *** No rule to make target '/home/aengelen/dev/ESP32-platform-firmware/esp-idf/tools/kconfig/conf-idf', needed by '/home/aengelen/dev/ESP32-platform-firmware/firmware/build/include/config/auto.conf'.  Stop.
make[1]: Entering directory '/home/aengelen/dev/ESP32-platform-firmware/esp-idf/tools/kconfig'
cc -c  -DCURSES_LOC="<curses.h>" -DLOCALE -MD  /home/aengelen/dev/ESP32-platform-firmware/esp-idf/tools/kconfig/mconf.c -o mconf.o
<command-line>: fatal error: curses.h: No such file or directory
compilation terminated.
make[1]: *** [Makefile:171: mconf.o] Error 1
make[1]: Leaving directory '/home/aengelen/dev/ESP32-platform-firmware/esp-idf/tools/kconfig'
make: *** No rule to make target '/home/aengelen/dev/ESP32-platform-firmware/esp-idf/tools/kconfig/conf-idf', needed by '/home/aengelen/dev/ESP32-platform-firmware/firmware/build/include/config/auto.conf'.  Stop.

[nix-shell:~/dev/ESP32-platform-firmware]$

Is there something further I have to do to make sure curses.h can be found? (for the full thing so far see Comparing badgeteam:master...raboof:nix · badgeteam/ESP32-platform-firmware · GitHub)

1 Like

Thanks to some great help by @lopsided98 on IRC I found Development environment with nix-shell - NixOS Wiki (I was following the ‘pills’ earlier) and got a bit further.

I’m now stuck on the included (non-nix) xtensa binary not finding libstdc++, but it looks like there’s a number of ways to solve that documented at Different methods to run a non-nixos executable on Nixos - Unix & Linux Stack Exchange .

To be continued :wink:

1 Like

Solved it by following FAQ - NixOS Wiki and using that in the mkShell shellHook: Comparing badgeteam:master...raboof:nix · badgeteam/ESP32-platform-firmware · GitHub

1 Like