This snippet gives me an error that vscodeExtensions isn’t defined, can you please provide a self-contained example that can be built and shows exactly your problem?
Also can you please elaborate if the error about the mising kubectl happens during build or during runtime of VScode? If it is the latter, just add kubectl to your environment.systemPackages/home.packages. The VScode buildscript doesn’t use kubectl in anyway and will therefore discard the given buildtime dependency for runtime.
If you want to create a selfcontained VScode that comes with its own kubectl, you need to “wrap” vscode, which I would probably do in another derivation, rather than through an override.
One example of a wrapper that adds to an environment variable can be seen in my configuration for gnucash. Be aware that this is one of the first wrappers I wrote and today I would probably use a symlinkJoin rather than runCommand.