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

No longer applies shell.nix to integrated terminal? #76

Open
devmattrick opened this issue Dec 17, 2022 · 2 comments
Open

No longer applies shell.nix to integrated terminal? #76

devmattrick opened this issue Dec 17, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@devmattrick
Copy link

Describe the bug
I'm not sure if this is caused by the VSCode update that came out recently, but I noticed that the shell.nix file no longer seems to be being applied to the integrated terminal. I noticed it after updating to the most recent version but it could also be unrelated to that.

To Reproduce
Steps to reproduce the behavior:

  1. Open a project in VSCode containing a shell.nix file
  2. Load the environment using this Extension
  3. Open the integrated terminal in VSCode
  4. Try to use one of the executable files specified in shell.nix
  5. Note that the executables are not found
  6. Run nix-shell ./shell.nix
  7. Note that the executables are now available in the terminal

Expected behavior
The integrated terminal should load with the executables (and libraries) provided in shell.nix.

Screenshots
N/A

Environment:

  • OS: NixOS 22.11
  • VS Code
  • VSCode: 1.73.1 / Extension: 1.0.9

Additional context
N/A

@devmattrick devmattrick added the bug Something isn't working label Dec 17, 2022
@sheepman4267
Copy link

Tried the extension for the first time last night and found it very strange that the terminal wasn't affected by the nix environment. Glad to see this might be unintentional.

@Zaczero
Copy link

Zaczero commented Feb 17, 2023

I have found a temporary workaround for those who are using launch.json.

Perhaps it is possible to find a similar solution for a global case, but for me, launch.json fix is enough.

Basically, all you need to do is manually pass the $PATH environment:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "My Project",

            // ...

            "env": {
                "PATH": "${env:PATH}",
            },

            // ...
        }
    ]
}

Edit: This worked with Python module launch but not with Python file launch. This may not work in all scenarios.


For a global solution you could automatically enter nix-shell if present in the current directory.

An example using .zshrc:

if [ -f ./shell.nix ]; then
  if [ -z "$IN_NIX_SHELL" ]; then
    nix-shell
  fi
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants