Hi nix community, loving the idea behind nix/nixos.
I’m trying out nixos and nix (in docker) to host a rust program. It’s asking me to set OPENSSL_DIR or OPENSSL_LIB_DIR, I installed:
nix-env -iA nixos.openssl
Is that the right package or is there a -dev package somewhere?
Do I need to give it some flags (somehow) for nix to install the openssl lib and includes?
Is there a recommended way to pick up the dir that nix is using for openssl?
Thanks in advance,
Giles
1 Like
This lead me to the answers:
opened 04:54PM - 26 Apr 16 UTC
closed 05:36PM - 26 Apr 16 UTC
I'm trying to fix `siege` package and found, that `out` and `dev` outputs for `o… penssl` are ... strange.
```
$ du -a /nix/store/*openssl-1.0.2g{,-dev}/lib
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libnuron.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libchil.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/lib4758cca.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libgmp.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libpadlock.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libcswift.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libaep.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libubsec.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libgost.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libatalla.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libsureware.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines/libcapi.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/engines
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/libcrypto.so.1.0.0
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/libssl.so.1.0.0
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/pkgconfig/openssl.pc
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/pkgconfig/libcrypto.pc
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/pkgconfig/libssl.pc
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/pkgconfig
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/libssl.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib/libcrypto.so
/nix/store/cd50ncj52230kmv6sbxhf9ybs7s6m3cq-openssl-1.0.2g/lib
/nix/store/15qighn2am7p580xwxdaqdmvhdf86x5l-openssl-1.0.2g-dev/lib/pkgconfig/openssl.pc
/nix/store/15qighn2am7p580xwxdaqdmvhdf86x5l-openssl-1.0.2g-dev/lib/pkgconfig/libcrypto.pc
/nix/store/15qighn2am7p580xwxdaqdmvhdf86x5l-openssl-1.0.2g-dev/lib/pkgconfig/libssl.pc
/nix/store/15qighn2am7p580xwxdaqdmvhdf86x5l-openssl-1.0.2g-dev/lib/pkgconfig
/nix/store/15qighn2am7p580xwxdaqdmvhdf86x5l-openssl-1.0.2g-dev/lib
```
So, `out` has all the .so files, but `dev` doesn't. How's that?
Specifically `siege` requires .so files and includes, so .so files must be present in `dev` output
The lib, includes are in a dir with ‘-dev’ appended in the /nix/store rather than in the standard dir.
TODO: Find nice way to pick up that dir.
c0bw3b
October 26, 2018, 5:12pm
4
openssl
is a split package (with multiple outputs). Read more about it there especially “using a split package”
The dir your are looking for is actually the attribute openssl.dev
in nix parlance.
Side comment: openssl
still points to v1.0.2. If you are starting a fresh project you might want to use openssl_1_1_0
:
nix-env -iA nixos.openssl_1_1_0
1 Like
vcunat
October 29, 2018, 5:54pm
5
Adding to the answer from Linus, you probably don’t want to use nix-env
for this. Typical cases
you want to do the full build of the program via a nix-build
(you need to write a nix expression for that); or
you want a development environment via nix-shell -p openssl
(writing shell.nix
can be useful for complex cases or repeated usage).
3 Likes
That’s really working well.
or not. thread ‘main’ panicked at /home/gilescope/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.93/build/main.rs:79:9:
OpenSSL include directory does not exist: /home/gilescope/.nix-profile/bin/openssl/include
The answer is to get every project in the world to compile with rustls by default. That’s the only way right? Or could I perhaps get into a shell that has the includes hanging about? I just want cargo install cargo-raze to work. I get this with every tool that tries to use openssl. It’s so boring. (no pun intended)
vcunat
September 6, 2023, 2:06pm
8
This directory seems really suspicious. Even searching includes inside bin. And you surely don’t want to involve nix-profile anyway, as that brings more issues than advantages (I wrote about that in my previous post).
1 Like