Hi, I planning to use flakes for all of my development projects but when trying it out I came across a question I couldn’t find an answer to.
First, this is what I’m trying to achieve: I’m developing a Rust application which
- Depends on
postgres
- Should not depend on
openssl
The first point is easily handled by specifying the postgres
package in the flake.nix
file. This will “overwrite” any versions possibly installed on my system and everything is fine.
But how to handle the second requirement, when I’m not sure if openssl
is installed on the system?
With nix develop
all the programs installed on my computer are also available in the development environment, which would also make openssl
available to the development environment.
Therefore I tried using nix develop -i
which from my observations only removes my user’s profile from the path (/etc/profiles-per-user/<name>/bin
). The system-wide installed programs are still available (path contains /run/current-system/sw/bin
).
In my case I don’t have openssl
installed system wide, but what if I (need to) install it on my system or another program (which has it as a dependency) is installed system wide? Is there a way to ensure that the development environment does not have access to openssl
?
Thanks a lot in advance
Edit: I just found out that it seems to be important that I’m running NixOS. The command nix develop -i --command bash --norc
seems to work but when I try using it with --command zsh --no-rcs
it again does not “remove” system wide installed programms from the path.