devenv
devenv copied to clipboard
Best way to add sys dependencies of Python libraries?
trafficstars
I'm making a devenv setup to provide python and spaCy (which depends on zlib and libstdc++). I ended up with:
# devenv.nix
{ pkgs, ... }:
{
packages = [ pkgs.zlib pkgs.stdenv ];
languages.python.enable = true;
languages.python.version = "3.11";
languages.python.venv.enable = true;
languages.python.venv.requirements = ./requirements.txt;
enterShell = "export LD_LIBRARY_PATH=${pkgs.zlib}/lib:${pkgs.stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH";
}
# requirements.txt
spacy==3.7
Is that the recommended way to do so? (Ideally I'd like nix itself to provide spaCy, so it and its dependencies are locked along with the rest of the config, but adding it to packages resulted in build errors)