NisOS: Need help finding what path rust is looking for (openssl)

Hello, I’m pretty new to NixOS and I was wondering if anyone else had this issue.

Any time I try to compile a rust binary that has “openssl-sys” as a dependency, cargo tells me that it can’t find openssl library on my computer. Here’s the whole error if you’re curious:

Error on pastebin

When I run this on windows it works flawlessly, and on Ubuntu all I had to do was sudo apt install libssl-dev. I have both openssl and opensll.dev in my configuration.nix file too.

Basically, I’m used to the crate automatically detecting where the files relating to openssl are and was wondering if anyone has some insight. Thanks!

So far I found that adding this:
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
to a shell.nix file in the root directory of my rust project does the trick.
Where I got the answer
Further reading