I am using devenv for my python development through devShells in my flake.nix. The default path for python virtual env is $env.DEVENV_ROOT/something
but my devenv root is set to /
so to make any changes, I’ll need to root. Can I change my devenv root to my home directory/.shells
or is there a different way to invoke nix develop
so that I wouldn’t be dropped into a root shell.
nix develop --impure
Thanks that helped. I am facing a new issue though, my jupyter installed in the packages section of devenv cannot see packages installed with pip inside devenv. How do I install jupyter inside venv?
I enabled venv with languages.python.venv.enable
Edit: fixed it by running jupyter with python -m
2 Likes
Nice! Could you post the whole devenv.nix for posterity?
1 Like
I use flake.nix, so in the outputs I add this
# Develpment environment shells
devShells.${pkgs.system}.py = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [{
languages.python.enable = true;
languages.python.venv.enable = true;
packages = with pkgs;
[
(python3.withPackages (ps:
with ps; [
wheel # for building pip packages
jupyter
numpy
pandas
scikit-learn
nltk
scipy
matplotlib
]))
];
}];
};
I can then invoke the shell with nix develop --impure .#py
1 Like