Currently, when building cmake projects in Nix, cmake will sometimes try to
pull in headers/libraries from impure directories like /usr. I think I've
found the way to disable this behavior, but I need some help writing the
derivation/scripts to do this.

If the cmake command is invoked with the following flags:

-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY

then cmake will *only* search for libraries and headers in paths specified
with the following flag:

-DCMAKE_FIND_ROOT_PATH=<list of search paths separated by semicolons>

My idea is to modify cmake's setup-hook.sh so that, when building a
derivation that depends on cmake, the cmake command automatically gets
called with the above flags, and CMAKE_FIND_ROOT_PATH only contains
directories specified in the derivation's buildInputs attribute.

This is where I need assistance: in cmake's setup-hook.sh, how can I get a
list of all the directories listed as buildInputs to the derivation?

The current setup-hook.sh finds all the dependencies' include/ and lib/
directories by looking at NIX_CFLAGS_COMPILE and NIX_LDFLAGS, but what I
actually need are all the dependencies' root directories (i.e., I need
$package, not $package/include).

Thanks in advance!
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to