arrterian / nix-env-selector

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

Stuck applying environment #56

Open Hjdskes opened 3 years ago

Hjdskes commented 3 years ago

Describe the bug Symptoms are equal to #49: after selecting the environment, the status remains "Applying environment..." forever.

To Reproduce Steps to reproduce the behavior:

  1. Install nix-env-selector 1.0.7
  2. Apply environment:

    { pkgs ? import ./haskell.nix
    , hsPkgs ? import ./default.nix {} }:
    
    let
      terraform = pkgs.terraform_0_14.withPlugins(p: [ p.aws ]);
    in hsPkgs.shellFor {
      # Include only the *local* packages of your project.
      packages = ps: with ps;
        [ shiba ];
    
      # Builds a Hoogle documentation index of all dependencies,
      # and provides a "hoogle" command to search the index.
      withHoogle = true;
    
      # You might want some extra tools in the shell (optional).
    
      # Some common tools can be added with the `tools` argument
      tools = { cabal = "3.2.0.0"; hlint = "2.2.11"; stylish-haskell = "0.12.2.0"; };
      # See overlays/tools.nix for more details
    
      # Some you may need to get some other way.
      buildInputs = with hsPkgs.haskellPackages;
        [ terraform pkgs.awscli ];
    
      # Prevents cabal from choosing alternate plans, so that
      # *all* dependencies are provided by Nix.
      exactDeps = true;
    }

    It's a fairly standard haskell.nix setup. Let me know if you need to see the rest of my nix files as well! I have the same problem with my work machine, with a similar haskell.nix setup.

Expected behavior I'd expect this plugin to do as advertised and load my nix environment.

Environment:

ShamrockLee commented 3 years ago

Same issue here.

samuela commented 2 years ago

How long does it take to enter the nix-shell from the command line? Sometimes activating a shell.nix requires downloading/building a bunch of stuff and I don't think nix-env-selector has a ui to show this. It just looks like it's taking a really really long time to load.

If nix-shell in the command line runs almost instantaneously but nix-env-selector takes a while than that sounds more like a bug to me.

samuela commented 2 years ago

See also https://github.com/arrterian/nix-env-selector/issues/59

ShamrockLee commented 2 years ago

@samuela In my experience, This extension never finishes applying the environment from a flake, even if it has already been invoked before and the related stuff has been cached.

samuela commented 1 year ago

@ShamrockLee I am now encountering this issue when using flakes as well. nix devlop runs instantaneously but I'm stuck in "Applying environment..." limbo when using nix-env-selector

aanderse commented 1 year ago

@samuela do you get this error when using shell.nix as well, or only with flake.nix?

samuela commented 1 year ago

@samuela do you get this error when using shell.nix as well, or only with flake.nix?

I previously saw this issue when using shell.nix, but it's possible those issues have now been fixed. I continue to see this issue with flake.nix.

aanderse commented 1 year ago

Thanks. For anyone else who runs into this and can't find a solution I was able to get the direnv vscode plugin working nicely.

aryairani commented 1 year ago

I'm having this issue in 1.0.9. @aanderse How were you able to get the direnv vscode plugin working nicely for this?

aanderse commented 1 year ago

@aryairani what troubles are you having with the direnv plugin? Maybe we should discuss that on their issue tracker instead of here.

aryairani commented 1 year ago

Hi @aanderse I didn't try it or have troubles, I was just asking to clarify the workaround you mentioned in your earlier message.

aanderse commented 1 year ago

Ah, understood. Simply install the plugin, following instructions, create a .envrc file in your project, then your nix environment is loaded by vscode. Nice and simple.