Skip to content
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

For python, how to use venvShellHook with numtide / devshell #309

Open
geekodour opened this issue Apr 26, 2024 · 0 comments
Open

For python, how to use venvShellHook with numtide / devshell #309

geekodour opened this issue Apr 26, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@geekodour
Copy link

geekodour commented Apr 26, 2024

We can use venvShellHook with plain shell.nix with something like

let
  pkgs = import <nixpkgs> { };
  pyPackages = pkgs.python311Packages;
in pkgs.mkShell {
  name = "py";
  venvDir = "./.venv";
  buildInputs = [
    pyPackages.pip
    pyPackages.venvShellHook
    pkgs.ruff # linter
    pkgs.python311
  ];

  postShellHook = ''
    pip install poetry
    unset SOURCE_DATE_EPOCH
  '';
}

And with vanilla flake with something like:

 devShells.default = pkgs.mkShell {
        nativeBuildInputs = with pkgs; [pkgs.python311Packages.pip pkgs.python311Packages.venvShellHook];
        venvDir = "./.venv";
 };

But with numtide / devshell it seems like I cannot use venvShellHook and hence no way to have the sweet virtual env created for me as I cd into the directory.

@geekodour geekodour added the enhancement New feature or request label Apr 26, 2024
@geekodour geekodour changed the title How to use venvShellHook with numtide / devshell For python, how to use venvShellHook with numtide / devshell Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant