However, I feel like the best scenario is to upstream a patch like I said above where the build is able to read from the environment. And then just have attrs like: NFSTREAM_PCAP_LIB= "${lib.getLib libpcap}/lib/libpcap.a"; in your nix expression.
gcc: error: /local/lib/libpcap.a: No such file or directory
gcc: error: /local/lib/libndpi.a: No such file or directory
gcc: error: /local/lib/libgcrypt.a: No such file or directory
gcc: error: /local/lib/libgpg-error.a: No such file or directory
Add all of the libraries to buildInputs, in addition to what you already have done. This should pass the correct -I arguments to gcc. -I is how gcc allows for additional paths to be added when resolving bracketed includes (e.g. #includes <xxx.h> )
I’ve added the changes that u suggest, and now get this error about pkg-config.
the derivation is here: http://ix.io/3Dil
and error:
these 2 derivations will be built:
/nix/store/q6s3anbzrif0n2nnm6zlbhf6kimrd82v-ndpi-static-x86_64-unknown-linux-musl-3.4.drv
/nix/store/bivxl9aajj9dhv2q9x1yn9yjv0r01g3v-python3.9-nfstream-6.3.5.drv
building '/nix/store/q6s3anbzrif0n2nnm6zlbhf6kimrd82v-ndpi-static-x86_64-unknown-linux-musl-3.4.drv'...
unpacking sources
unpacking source archive /nix/store/r0i1b97x1iv5nh04hl242lss0ynf494m-source
source root is source
patching sources
applying patch /nix/store/dybyfbdi49il1s45pf5xdm1wwpx8n6q4-3.4-CVE-2021-36082.patch
patching file src/lib/protocols/netbios.c
patching file src/lib/protocols/tls.c
updateAutotoolsGnuConfigScriptsPhase
configuring
configure flags: --prefix=/nix/store/jw4lm75h3bmmhh8542w2npdc7k9kfdr7-ndpi-static-x86_64-unknown-linux-musl-3.4 --disable-shared --enable-static --disable-shared --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-musl
pkg-config is missing: please install it (apt-get install pkg-config) and try again
building
no Makefile, doing nothing
installing
install flags: SHELL=/nix/store/wv35g5lff84rray15zlzarcqi9fxzz84-bash-4.4-p23/bin/bash install
make: *** No rule to make target 'install'. Stop.
error: builder for '/nix/store/q6s3anbzrif0n2nnm6zlbhf6kimrd82v-ndpi-static-x86_64-unknown-linux-musl-3.4.drv' failed with exit code 2;
last 10 log lines:
> patching file src/lib/protocols/tls.c
> updateAutotoolsGnuConfigScriptsPhase
> configuring
> configure flags: --prefix=/nix/store/jw4lm75h3bmmhh8542w2npdc7k9kfdr7-ndpi-static-x86_64-unknown-linux-musl-3.4 --disable-shared --enable-static --disable-shared --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-musl
> pkg-config is missing: please install it (apt-get install pkg-config) and try again
> building
> no Makefile, doing nothing
> installing
> install flags: SHELL=/nix/store/wv35g5lff84rray15zlzarcqi9fxzz84-bash-4.4-p23/bin/bash install
> make: *** No rule to make target 'install'. Stop.
For full logs, run 'nix log /nix/store/q6s3anbzrif0n2nnm6zlbhf6kimrd82v-ndpi-static-x86_64-unknown-linux-musl-3.4.drv'.
error: 1 dependencies of derivation '/nix/store/bivxl9aajj9dhv2q9x1yn9yjv0r01g3v-python3.9-nfstream-6.3.5.drv' failed to build
One thing to note with buildPythonPackage is that it by default has strictDeps = true; which means that if you want a command from a package to be available, it needs to go into nativeBuildInputs, or you can set strictDeps = false;, and then commands from buildInputs will also be available