arrterian / nix-env-selector

Allows switch environment for Visual Studio Code using Nix Package Manager.
MIT License
220 stars 29 forks source link

Terminal running in environment #31

Open jamievicary opened 4 years ago

jamievicary commented 4 years ago

I've got this working, but when I want to build manually I still need to write "nix-shell" in the terminal by hand, it seems. Could this not be done automatically by the extension?

GuillaumeDesforges commented 3 years ago

This should rather be an option, as sometime you want to get out of the nix-shell to edit it and debug it.

rvanlaar commented 3 years ago

An idea, document the behavior. I'm rather new to nix pkgs. My first thought that the extension was broken since the packages weren't available in the terminal.

paulhdk commented 3 years ago

Please correct me if I'm wrong, but a workaround could be to set up direnv in the project folder. That way, every time one enters the project directory via the VS Code terminal, nix-shell is started. At least it seems to be working for me.

m1cr0man commented 2 years ago

Another simple solution I found is to add a custom terminal profile. Here's an example you can drop into your code-workspace config:

{
    "settings": {
        "terminal.integrated.profiles.linux": {
            "Nix Shell": {
                "path": "nix-shell",
                "icon": "terminal-linux",
            },
        },
        "terminal.integrated.defaultProfile.linux": "Nix Shell"
    }
}

There is that couple second delay when you open a window from running nix-shell but it's not nearly as bad as waiting for it to open then running nix-shell yourself :)

Kruemmelspalter commented 2 years ago

this is a good workaround for now, but I think it would still be good for the plugin to somehow include this functionality