I’m sure this topic has been discussed a lot, but in all of my searching I haven’t found a clear answer.
I keep running into the issue of wanting to build a program off of GitHub, and the build fails because it can’t find necessary libraries and headers.
Today’s example is sokol-zig, which is built using zig
and has these instructions:
On Linux install the following packages: libglu1-mesa-dev, mesa-common-dev, xorg-dev, libasound-dev (or generally: the dev packages required for X11, GL and ALSA development)
Aside from this being vague, let’s take the ALSA one. I’m assuming in nixpkgs I need to install alsa-lib
. But of course, installing that with nix shell
or adding it to my shell.nix
in pkgs.mkShell.packages
doesn’t help, the project’s build script can’t find it.
I know a lot of these dev packages get added to $NIX_CFLAGS_COMPILE
, but that only works if the build script uses the clang wrapper. Tools like zig
have their own internal copy of clang.
So how do I get these added to the environment’s $PATH
like a traditional Linux environment? Even if it’s a temporary one created by my shell.nix
shell, there has to be a way to make these libraries visible in a traditional manner. Any ideas on how I can pull that off would be greatly appreciated.