New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vscode-with-system-extensions: WIP #148235
base: master
Are you sure you want to change the base?
vscode-with-system-extensions: WIP #148235
Conversation
Allow one to bundle extensions as part of a custom vscode derivation. This should leave room for user to dynamically experiment / install extensions while running on a solid based with good nixos integration. - A 'libredirect-self' attempt at avoidinging the huge electron copy. - Robustify 'vscode' binaries in the event of multiple glibc version by forcing glibc's addition as rpath.
Phew. First of all, I really appreciate that you're putting effort into making vs code extensions better. It's a complicated topic with no optimal solution in the past yet, I believe. But if this PR is the way to go, I'll have to remove myself from the maintainers list. Why: Mainly because there is a lot of C code in there which I don't understand. Which means that if it breaks, I don't know who will fix it. Maybe you, but who else if you're not available? Upstream vscode development is impossible to predict, so I assume that breakage is likely when vscode changes. Why do I not understand this C code? This is probably to a large extent because I haven't done much C programming. Is it really necessary to write this in C, or is there maybe a shell workaround? But I think there are some other aspects that might improve the situation:
But honestly, someone with much more C knowledge than me has to comment. |
@turion very well put I think. My €0.02:
|
Hi @turion and @Synthetica9 and thanks for taking some time looking at this. @turion : The C code is only for This is currently a draft, my intention was to get some help making this work without have to create an electron copy (i.e: reuse the existing copy). A much simpler (less efficient but most likely more robust) approach would be to simply integrate this to the existing vscode derivation adding a
Most likely, I assume it uses the same extension mechanism and electron.
That would be nice once converging once a final acceptable solution if picked. Remember, this is merely a draft. I would be interested in the approach you would use to automate the check that vscode still works and that the extensions were effectively loaded (vscode being a gui). |
Some refs to the electron copy I would like to avoid:
And the commented out failed attempt at using an
|
Probably something like:
We'd test this the same way we currently test gui applications, including vscodium: by just simulating keypresses, see https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/vscodium.nix |
@Synthetica9 : Thanks for the example, I was wondering how you would handle getting a feedback post you key-presses. Using the "save as" side effect was quite crafty. I will have to think about something like this to validate extensions functionality. Clearly some extensions change the editor text so I would be able to re-use the same save trick. |
While I like the idea I'm not sure if we should do this as long as you can easily download extensions from the website / use extensionsFromVscodeMarketplace and declaratively use them. Of course some users don't want to configure everything declaratively but I think this is a drawback you sometimes need to make with nix. |
@mohe2015 I think that this PR allows vscode to both install extensions imperatively and declaratively |
@pasqui23 / @mohe2015 : Exactly, it allows both and that is the exact reason why I think it would be the best approach if we find a way solve the above mentioned size issue (it might even be deemed quite acceptable without solving this issue given what it brings to the table). However, I think I tried too early to attempt fixing this size issue and it just lead to unwarranted complexities. These are apparently getting in the way of showcasing this new approach. When I have some more spare time, I think I will just open separate cleaner non-draft PR with the simpler |
This is a work in progress / draft, an idea that I had for quite some time and I finally got some time to implement.
This works really well (on both stable and unstable) and leave room for you to install extensions dynamically while profiting from our nixpkgs integrated extensions set (which is sometimes required).
However, major thing (in my opinion) that remain is that I wasn't able to avoid the big ~126MiB electron copy. Also some cleanup required depending on the chosen solution. Note that this will get reclaimed back on
nix-store --optimise
(hardlinking both copies), however I would prefer to avoid this.I wanted to get some fresh ideas how to get rid of this copy. I tried some
LD_PRELOAD
patch but this was a failure, the programs fails to load. The ideal would be that upstream do something about it (see [Feature Request]: Add an option to specify the resource directory · Issue #31121 · electron/electron), however that might not happen soon unless we feed them with some well crafted PR (which I wasn't yet able to do). Patching our copy is not yet an option as we're not yet building electron ourselves from sources (see #17073).To make it work on stable, you need to add the following lines as well (after the
code
electron binary copy):Here's a ref to the issue comment that gave me this idea in the first place:
Allow extensions to be installed for all users · Issue #56614 · microsoft/vscode
Dampfwalze commented on Sep 23
Motivation for this change
Allow users to dynamically install extension while still being backed by our fine well integrated extension set.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notesExtra system / builtin extensions are all displayed in vscode's extensions pane (
ctrl+shift+x
) alongside other builtins when typing@builtin
in the search box. Extensions all seem to work fine (I am currently working with a huge set of extra builtin extensions> 20
).