Closed jcszymansk closed 1 year ago
Found a workaround:
(asf.apache-netbeans-java.overrideAttrs (_: { sourceRoot = "extension"; }))
We fetch extensions as .zip
archives that get unpacked when building an extension derivation. The sourceRoot
attribute (see the nixpkgs manual) of an extension derivation affects the unpackPhase
of the derivation.
This much I figured out, indeed it was where I took this sourceRoot
from. Now I think how it would be possible to - in a way similar to what is being done with Intellij plugins, see here - have some specialExts.nix
file where extensions that need special treatment, like the Netbeans one, would receive it.
I'll look into it and hopefully come back with a pull request.
@jacekszymanski, I found a way to provide overrides. See https://github.com/nix-community/nix-vscode-extensions#special-extensions
Great! So I think I can close this issue now :+1:
@jacekszymanski, please, check that it works. I have a quite slow Internet connection and can't nix build
.
UPD: it finally worked!
Yes, I can confirm it works.
Extension ms-vscode.cmake-tools
recently started to fail to build as well. Version 1.17.14 builds fine, but versions 1.17.15 and up fail.
# Version 1.17.14 (succeeds)
nix build github:nix-community/nix-vscode-extensions/856a8c1902513fa72f86963bd9f3c9238828c23a#extensions.x86_64-linux.vscode-marketplace.ms-vscode.cmake-tools
# Version 1.17.15 (fails)
nix build github:nix-community/nix-vscode-extensions/f495145caabb9a3b5bb3ae2815a66db1c3fbe31d#extensions.x86_64-linux.vscode-marketplace.ms-vscode.cmake-tools
Since 1.17.15, the .vsix contains additional _rels
and package
directories, which appear to contain a digital signature for the extension.
The workaround described in https://github.com/nix-community/nix-vscode-extensions/issues/31#issuecomment-1636838281 works, but considering that .vsix files have a fixed structure, I thought, "Why not just set sourceRoot = "extension";
for all extensions?" So I went ahead and submitted https://github.com/NixOS/nixpkgs/pull/289721 to nixpkgs, since nix-vscode-extensions is relying on vscode-utils from nixpkgs to define the derivations for VSCode extensions.
I'm not sure whether the extension directory must be named extension
, have you found it documented anywhere?
From what I remember the .vsix has a manifest file that points at a package.json
which in most (all?) extensions happens to be in an extension
directory, but I didn't find out then whether it is a documented subdirectory or a default build packaging which some extensions might not follow?
Hmm, no, truthfully I just assumed. I used nixpkgs-review
on my change and all VSCode extensions defined in nixpkgs built successfully, but there could be extensions that ended up empty, I suppose, I didn't check... If everybody is publishing extensions the same way though, then in practice every .vsix should have the extension in extension
. In the worst case, we can just override the sourceRoot
for the exceptions. :smile:
The Netbeans extension (
asf.apache-netbeans-java
), possibly others, have multiple directories in the zipfile, and this causes the build to fail: