Rust-env-demo error

Hi. I’m a very novice user to flox and nix. I’m running Debian 12 Bookwork fresh install and just installed Flox per Flox docs. While trying to do the “flox in 5 minutes” demo I get the following error when running Cargo Run:
cargo run
Compiling openssl-sys v0.9.87
error: failed to run custom build command for openssl-sys v0.9.87

Caused by:
process didn’t exit successfully: /home/xytras/flox/rust-env-demo/target/debug/build/openssl-sys-9ed23725276d135a/build-script-main (exit status: 101)
— stdout
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=OPENSSL_STATIC
cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
run pkg_config fail: PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "openssl" did not exit successfully: exit status: 1
error: could not find system library ‘openssl’ required by the ‘openssl-sys’ crate

— stderr
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc’
to the PKG_CONFIG_PATH environment variable
Package ‘openssl’, required by ‘virtual:world’, not found

— stderr
thread ‘main’ panicked at ’

Could not find directory of OpenSSL installation, and this -sys crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the OPENSSL_DIR environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, libssl-dev on Ubuntu or openssl-devel on Fedora.

If you’re in a situation where you think the directory should be found
automatically, please open a bug at GitHub - sfackler/rust-openssl: OpenSSL bindings for Rust
and include information about your system as well as this message.

$HOST = x86_64-unknown-linux-gnu
$TARGET = x86_64-unknown-linux-gnu
openssl-sys = 0.9.87

', /home/xytras/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.87/build/find_normal.rs:190:5
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Any ideas? Thanks

Hey thanks for your report, I’ll get this passed along to our engineers.

@xytras Can you verify that you are in a flox development environment? which cargo should return something like /nix/store/n05kbk1c1d750yv9d36jxs4ar7sp3s6p-auditable-cargo-1.71.1/bin/cargo not /usr/bin/cargo. You can enter the development environment with flox develop rust-env.

Another thing to try is to run pkg-config --libs --cflags openssl inside the development shell and examine the error.

Ensuring things like openssl libraries are available is one of the flox core features. If you are still having difficulties, please let us know.