VSCode extensions not matching shell.nix configuration

Hey all, I’m quite new to nix and I’ve started using direnv recently and I don’t think I understand how it works at all.

I’m trying to isolate VSCode extensions inside a project from my global extensions. I created shell.nix

{pkgs ? import <nixpkgs> {
config.allowUnfree = true;}, ...}: 
pkgs.mkShell {
    packages = with pkgs; [
      vscode
      (vscode-with-extensions.override {
        vscodeExtensions = with vscode-extensions; [
          vue.volar
        ];
      })
    ];
}

with only one extension, and in my .envrc

use nix ./shell.nix

which should enter into the shell whenever I enter the directory (I’ve added zsh.interactiveShellInit = ''eval "$(direnv hook zsh)"'' in configuration.nix). After direnv loads the shell, running code . still shows the same set of extensions I currently have installed. I initially thought that I could isolate my extensions and other programs using nix-shell or nix develop but this doesn’t seem to be the case?

My initial attempt did produce a VS Code set up with only one extension but I was unable to reproduce it. Running nix-shell ./shell.nix also doesn’t change the extensions. Perhaps the extensions are cached somewhere? Doing use flake /path/to/flake/#<shell> also didn’t change the list of extensions.

The list of extensions is shown below.

../Project/ > nix-shell ./shell.nix --pure

[nix-shell:../Project/]$ code --list-extensions
christian-kohler.path-intellisense
equinusocio.vsc-material-theme
equinusocio.vsc-material-theme-icons
github.copilot
ms-vscode-remote.remote-containers
visualstudioexptteam.vscodeintellicode
vscodevim.vim

[nix-shell:../Project/]$    

Any help would be greatly appreciated, I’ve been doing trial and error for the past few hours and I can’t get it to work at all.