Closed Guusvanmeerveld closed 2 weeks ago
Experiencing the same here. Are you managing local VSCodium extensions with Nix and have immutable extensions directory enabled?
Yep, you can find my local vscode configuration here
I got this, too. Is there any progress?
I do not have this issue with official Vscode and with mutable extensions directory. Feel free to open a PR that fixes this if you can figure out why it happens.
If I enable immutable extensions directory on client side, I noticed:
I tried to observe the extracted directory for what is happening when I try to install a locally installed extension, and found that package.json
is missing in the uploaded extension causing the error. I have also confirmed that package.json
is missing in the unextracted file from the beginning.
My guess is, if immutable extensions directory is enabled, due to extensions are managed by Nix vscode is having a different behavior for installing extensions. This might have resulted in partial upload of the locally installed content.
A workaround I found is to add extension's unique identifier into vscode settings remote.SSH.defaultExtensions
(link to doc), because the default extensions are downloaded from marketplace on server side instead of uploading from local.
At this point, I suspect the underlying issue is not related to this project at all. If I have more time I may try to look further into why package.json
is not present in the uploaded extension.
Personally, to get around this issue, I copied the code that home-manager uses to install extensions with an immutable extensions directory:
{
config,
lib,
pkgs,
...
}: let
extensions = config.services.vscode-server-extensions;
cfg = config.services.vscode-server;
extensionDir = cfg.installPath;
extensionPath = "${extensionDir}/extensions";
extensionJson = pkgs.vscode-utils.toExtensionJson extensions;
extensionJsonFile = pkgs.writeTextFile {
name = "extensions-json";
destination = "/share/vscode/extensions/extensions.json";
text = extensionJson;
};
in {
options = {
services.vscode-server-extensions = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
};
};
config = lib.mkIf cfg.enable {
home.file = {
"${extensionPath}".source = (
let
subDir = "share/vscode/extensions";
combinedExtensionsDrv = pkgs.buildEnv {
name = "vscode-extensions";
paths =
extensions
++ lib.singleton extensionJsonFile;
};
in "${combinedExtensionsDrv}/${subDir}"
);
};
};
}
This is a bit of a crude solution, as this does mean that I have to specify all of the extensions that I want to twice, once on my client and once on my server, but for my use case, this is perfectly fine.
I have been using this flake for a while and its been working great, except I cannot seem to install server-sided extensions. Every time I try to install one I get an error of the following form:
Did I mess up something while setting up my config? I am using the following config:
I am using VSCodium version 1.88.1