NixOS in WSL - how to install VScode extensions

Looking for this as well.

For now, I just add the extensions to workspace recommendations. Then, when i switch to WSL, it asks me once if i would like to install the recommended extensions in WSL.

Going out of WSL and even when running nixos-rebuild preserves my installed extensions in NixOS, so it’s really a click-once and get over with it. Although i understand it isn’t really a NixOS mindset to do it like this.

You can also set remote.extensionKind in your .vscode/settings.json, to steer your extensions to the workspace (remote) instead of ui, but it doesn’t really help much in this case:

 "remote.extensionKind": {
        "arrterian.nix-env-selector": [
            "workspace"
        ],
        "jnoortheen.nix-ide": [
            "workspace"
        ]
    }

Maybe something like nix4vscode could solve this, please see deprecate nix-vscode-extensions in favor of nix4vscode · Issue #47 · nix-community/nix-vscode-extensions as well. For me that still feels too primitive.

2 Likes