New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use devShell environment in package derivation #1132
Comments
@shishkin can you give a bit more explanation what you're trying to do? |
I have a flake with devenv shell: devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
languages.python = {
enable = true;
package = pkgs.python3;
poetry = {
enable = true;
activate.enable = true;
install = {
enable = true;
installRootPackage = false;
quiet = false;
};
};
};
}];
}; Now I want to be able to use this shell environment in a package derivation: packages.default = pkgs.stdenv.mkDerivation {
inherit system;
# can this work?
nativeBuildInputs = [ self.devShells.${system}.default ];
buildPhase = ''
# python and poetry dependencies are not available :(
'';
}; Is it possible to reuse shell environment in a derivation? |
That's not possible since derivation expects no networking access, which is required by most package managers like poetry. |
Hm.. I thought that's what devenv would be effectively sidestep. When I enter my shell, all the python packages are already in the venv directory. |
That is because it's a venv install side-effect generated by the devenv activation script. There are some blog posts on the internet that advocate disabling the sandboxing for cases like this. |
Is it possible to use shell environment in
mkDerivation
? I've setup a devenv shell environment and would like to reuse it for package building. I tried addingself.devShells.${system}.default
tobuildInputs
ofmkDerivation
but that didn't get the required tools on the builder path.The reason I'm doing this is that I have a python poertry environment that I wasn't able to get working on vanilla nix and was quite happy when it just worked in devenv.
The text was updated successfully, but these errors were encountered: