nix-community / nix-vscode-extensions

Nix expressions for VSCode and OpenVSX extensions [maintainers: @deemp, @AmeerTaweel]
MIT License
223 stars 13 forks source link

Some extensions b*tch about not being able to write into the extensions directory #46

Open yangm97 opened 1 year ago

yangm97 commented 1 year ago

Noticed this at the console:

Error while activating TypeScript/JavaScript: {"errno":-2,"code":"ENOENT","syscall":"stat","path":"/nix/store/lc0l4y05jrfpqr5j5h70pjchpx801h6y-vscode-extension-visualstudioexptteam-vscodeintellicode-1.2.30/share/vscode/extensions/visualstudioexptteam.vscodeintellicode/cache"}.

I suppose this extension in particular isn't following the best practices and stuff, but I wonder what would be a fix that doesn't depend on upstream.

mobsenpai commented 1 year ago

Yeah. The same is happening with this extension: https://open-vsx.org/extension/golf1052/base16-generator, I have used it to auto select various themes using base16 colors, but It is throwing errors, only If I install it this way. Otherwise if I install from extensions tab inside vscode, it works.

billy4479 commented 11 months ago

Same for the catppuccin theme. Changing accent color causes Error: EROFS: read-only file system, open '/home/<user>/.vscode-oss/extensions/catppuccin.catppuccin-vsc/themes/mocha.json'. I'm installing it in the "normal" way from vscode as a workaround for now. NVM just had to RTFM

AmeerTaweel commented 8 months ago

I recently came across this Reddit post. The post and comments mention Nix-Bwrapper and NixPak for sandboxing packages. Maybe we can wrap extensions that want to write to the extensions directory, and bind another writable directory in their write location.

deemp commented 3 months ago

@AmeerTaweel, have you tried to implement your solution? If yes, what were the outcomes?

AmeerTaweel commented 2 months ago

Sorry for the late reply @deemp.

I tried using both Nix-Bwrapper and NixPak to sandbox VSCode extensions, but I was unsuccessful.

I could not reproduce @yangm97's issue with visualstudioexptteam.vscodeintellicode.

I was able to reproduce @mobsenpai's issue with golf1052.base16-generator. However, both Nix-Bwrapper and NixPak are designed to sandbox binaries. And the extension only contains JS files, so I was out of luck...

However, I still believe this approach might work with VSCode extensions that contain binaries.