nix-env-selector icon indicating copy to clipboard operation
nix-env-selector copied to clipboard

Stuck applying environment

Open Hjdskes opened this issue 4 years ago • 12 comments

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:

  • OS: Fedora 34 / Mac OS Big Sur
  • VS Code 1.55.2
  • Version 1.0.7

Hjdskes avatar Apr 24 '21 18:04 Hjdskes

Same issue here.

ShamrockLee avatar Jun 06 '21 16:06 ShamrockLee

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 avatar Dec 01 '21 00:12 samuela

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

samuela avatar Dec 01 '21 00:12 samuela

@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.

ShamrockLee avatar Feb 06 '22 00:02 ShamrockLee

@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

samuela avatar Feb 13 '23 19:02 samuela

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

aanderse avatar Apr 13 '23 16:04 aanderse

@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.

samuela avatar Apr 13 '23 16:04 samuela

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.

aanderse avatar Apr 18 '23 20:04 aanderse

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

aryairani avatar Jun 01 '23 02:06 aryairani

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

aanderse avatar Jun 04 '23 01:06 aanderse

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

aryairani avatar Jun 04 '23 02:06 aryairani

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.

aanderse avatar Jun 04 '23 09:06 aanderse