I installed boost using the nix package manager by $ nix-env -i boost
, but there are no boost headers in current generation of my profile.
Thus ~/.nix-profile/include/boost
does not exit, but the boost library files can be found in ~/.nix-profile/lib
.
I searched in the nix store and found the headers in boost-dev
folders within the store.
Why doesn`t nix link the boost headers into my current generation?
The boost
package is a split package, so it has multiple outputs.
$ nix-instantiate --eval -E '(import <nixpkgs> {}).boost.outputs'
[ "out" "dev" ]
In this case the out
output has the libraries, and the dev
output has the headers. Normally the dev
output is not installed to the user environment when you use nix-env -i
. But it is used internally when the package is a build dependency of another package.
You can see what outputs will be installed like this:
$ nix-instantiate --eval -E 'builtins.toString (import <nixpkgs> {}).boost.meta.outputsToInstall'
"out"
The documentation indicates that you can override meta.outputsToInstall
if you want other outputs.
My best attempt at doing this is:
nix-env -i -E \
'_: with import <nixpkgs> {};' \
'let newmeta = ( boost.meta // { outputsToInstall = ["out" "dev"]; } );' \
'in boost // { meta = newmeta; }'
Would be interested to hear of a less cumbersome version...
I suspect the real answer is that we shouldn't be trying to install development stuff into the user environment. Perhaps it's better to write a default.nix
file which defines development dependencies, and instantiate it with nix-shell
. See for example https://garbas.si/2015/reproducible-development-environments.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With