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
vscodium: allow using vscode extensions #76494
Conversation
Wouldn't that break things if you were to have both vscode and vscodium
installed at the same time? (can't that atm)
…On Wed, 25 Dec 2019, 14:06 Arnout Engelen, ***@***.***> wrote:
The extensions are in /share/vscode/extensions even for vscodium, and that
seems fine/convenient.
Things done
- Tested using sandboxing (nix.useSandbox
<http://nixos.org/nixos/manual/options.html#opt-nix.useSandbox> on
NixOS, or option sandbox in nix.conf
<http://nixos.org/nix/manual/#sec-conf-file> on non-NixOS linux)
- Built on platform(s)
- NixOS
- macOS
- other Linux distributions
- Tested via one or more NixOS test(s) if existing and applicable for
the change (look inside nixos/tests
<https://github.com/NixOS/nixpkgs/blob/master/nixos/tests>)
- Tested compilation of all pkgs that depend on this change using nix-shell
-p nixpkgs-review --run "nixpkgs-review wip"
- Tested execution of all binary files (usually in ./result/bin/)
- Determined the impact on package closure size (by running nix
path-info -S before and after)
- Ensured that relevant documentation is up to date
- Fits CONTRIBUTING.md
<https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md>.
Notify maintainers
cc @Synthetica9 <https://github.com/Synthetica9>
------------------------------
You can view, comment on, or merge this pull request online at:
#76494
Commit Summary
- Allow using vscode extensions in vscodium
File Changes
- *M* pkgs/applications/editors/vscode/with-extensions.nix
<https://github.com/NixOS/nixpkgs/pull/76494/files#diff-0> (2)
Patch Links:
- https://github.com/NixOS/nixpkgs/pull/76494.patch
- https://github.com/NixOS/nixpkgs/pull/76494.diff
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#76494?email_source=notifications&email_token=ABV7PJ3RF4UAUZWVED4OWKLQ2NLG7A5CNFSM4J7E3IAKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ICTN7OA>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABV7PJYQ53I23XPOR26Y2PTQ2NLG7ANCNFSM4J7E3IAA>
.
|
It seems to work for me. I have configured it in /etc/nixos/configuration.nix as:
Perhaps that's not the expected way to do it? |
I also just checked this and everything seems to work for me for vscode and vscodium. This kind of fixes #70624, even though at least some more documentation would be nice. |
@@ -70,6 +70,6 @@ runCommand "${wrappedPkgName}-with-extensions-${wrappedPkgVersion}" { | |||
ln -sT "${vscode}/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop" | |||
ln -sT "${vscode}/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop" | |||
makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" ${lib.optionalString (vscodeExtensions != []) '' | |||
--add-flags "--extensions-dir ${combinedExtensionsDrv}/share/${wrappedPkgName}/extensions" | |||
--add-flags "--extensions-dir ${combinedExtensionsDrv}/share/vscode/extensions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're going to pin the directory as $out/share/vscode
, you'll have to pin it at the vscodeExtension
as well, else this would break insiders which are installed in vscode-insiders
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I wasn't aware of vscode-insiders
.
Does this work at all though? I tried running it with the following shell.nix
:
{ pkgs ? import <nixpkgs> { config.allowUnfree = true; } }:
pkgs.mkShell {
buildInputs = [
(pkgs.vscode.override {
isInsiders = true;
})
];
}
but got:
$ nix-shell
these derivations will be built:
/nix/store/0nz6hqdkkmnnj4rv5872w7wpl6dfmyq8-code-insiders.desktop.drv
/nix/store/3bm496wq8q5wy50yi106swj7yj69bk0n-code-insiders-url-handler.desktop.drv
/nix/store/3s1w1xh5yihnirwdggk0ypip67bcfcd5-vscode-1.41.0.drv
building '/nix/store/3bm496wq8q5wy50yi106swj7yj69bk0n-code-insiders-url-handler.desktop.drv'...
building '/nix/store/0nz6hqdkkmnnj4rv5872w7wpl6dfmyq8-code-insiders.desktop.drv'...
building '/nix/store/3s1w1xh5yihnirwdggk0ypip67bcfcd5-vscode-1.41.0.drv'...
unpacking sources
unpacking source archive /nix/store/gyps4ls3zrfs1b9rjbln4aq19k7hlll4-VSCode_1.41.0_linux-x64.tar.gz
source root is VSCode-linux-x64
setting SOURCE_DATE_EPOCH to timestamp 1576089152 of file VSCode-linux-x64/resources/app/node_modules.asar
patching sources
glibPreInstallPhase
installing
substitute(): ERROR: file '/nix/store/p3hrd9k8hq3k134ma7vnlw98hj6lg0ma-vscode-1.41.0/lib/vscode/bin/code-insiders' does not exist
builder for '/nix/store/3s1w1xh5yihnirwdggk0ypip67bcfcd5-vscode-1.41.0.drv' failed with exit code 1
error: build of '/nix/store/3s1w1xh5yihnirwdggk0ypip67bcfcd5-vscode-1.41.0.drv' failed
$
(this is on nixos-unstable b0bbacb)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source is pinned on a stable version, if someone wants to use the insiders version, they need to change the src
as well.
vscode = (
super.vscode.override {
isInsiders = true;
}
).overrideAttrs (
_: rec {
name = "${pname}-${version}";
pname = "vscode-insiders";
version = "nightly";
src = builtins.fetchurl {
name = "VSCode_latest_linux-x64.tar.gz";
url = "https://vscode-update.azurewebsites.net/latest/linux-x64/insider";
};
}
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you use vscode-with-extensions with vscode-insiders? When I do it like this:
{ pkgs ? import <nixpkgs> { config.allowUnfree = true; } }:
let
vscode-insiders = ((pkgs.vscode.override {
isInsiders = true;
}).overrideAttrs (
_: rec {
name = "${pname}-${version}";
pname = "vscode-insiders";
version = "nightly";
src = builtins.fetchurl {
name = "VSCode_latest_linux-x64.tar.gz";
url = "https://vscode-update.azurewebsites.net/latest/linux-x64/insider";
};
}
));
extensions = [
pkgs.vscode-extensions.bbenoist.Nix
];
vscode-insiders-with-extensions = pkgs.vscode-with-extensions.override {
vscode = vscode-insiders;
vscodeExtensions = extensions;
};
in
pkgs.mkShell {
buildInputs = [
vscode-insiders-with-extensions
];
}
Then the extensions are broken:
[nix-shell:~/nixpkgs-vscode]$ cat `which code-insiders`
#! /nix/store/j78ycszn9vgn0khl0lcpbd087x2mmr66-bash-4.4-p23/bin/bash -e
exec "/nix/store/ypi2jh6mzy9v5qq46w0pc3f0m9fjjg8g-vscode-insiders-nightly/bin/code-insiders" --extensions-dir /nix/store/x8xnadwgpvprs0glp0m9nqyzxzm17m6v-vscode-insiders-extensions-nightly/share/vscode-insiders/extensions "$@"
[nix-shell:~/nixpkgs-vscode]$ ls /nix/store/x8xnadwgpvprs0glp0m9nqyzxzm17m6v-vscode-insiders-extensions-nightly/share/vscode-insiders/extensions
ls: cannot access '/nix/store/x8xnadwgpvprs0glp0m9nqyzxzm17m6v-vscode-insiders-extensions-nightly/share/vscode-insiders/extensions': No such file or directory
[nix-shell:~/nixpkgs-vscode]$ ls /nix/store/x8xnadwgpvprs0glp0m9nqyzxzm17m6v-vscode-insiders-extensions-nightly/share/vscode/extensions
bbenoist.Nix
So it seems this PR fixes that use case, rather than breaking it? Or is it common to use special 'insiders builds' of the extensions as well when running the vscode insiders build? Can you point me to an example of such an extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When overriding, based on the order of overrides, they propagate throughout the package set, so
self: super:
{
vscode = (
super.vscode.override {
isInsiders = true;
}
).overrideAttrs (
_: rec {
name = "${pname}-${version}";
pname = "vscode-insiders";
version = "nightly";
src = builtins.fetchurl {
name = "VSCode_latest_linux-x64.tar.gz";
url = "https://vscode-update.azurewebsites.net/latest/linux-x64/insider";
};
}
);
vscode-with-extensions = super.vscode-with-extensions.override {
vscodeExtensions = with super.vscode-extensions; [
ms-python.python
ms-vscode.cpptools
WakaTime.vscode-wakatime
] ++ super.vscode-utils.extensionsFromVscodeMarketplace [
...
since vscode
was overrided before vscode-with-extensions
the dependency on vscode
in vscode-with-extensions
points to the overriden version.
Here's how the files look for me (without this PR)
nixpkgs on develop [$]
➜ nix build nixpkgs.vscode-with-extensions
nixpkgs on develop [$] took 4s
➜ cat result/bin/code-insiders
#! /nix/store/j78ycszn9vgn0khl0lcpbd087x2mmr66-bash-4.4-p23/bin/bash -e
exec "/nix/store/ypi2jh6mzy9v5qq46w0pc3f0m9fjjg8g-vscode-insiders-nightly/bin/code-insiders" --extensions-dir /nix/store/z29gg27qiy42v9ps22mfr5pb1jm5fq69-vscode-insiders-extensions-nightly/share/vscode-insiders/extensions "$@"
nixpkgs on develop [$]
➜ l /nix/store/z29gg27qiy42v9ps22mfr5pb1jm5fq69-vscode-insiders-extensions-nightly/share/
total 0
dr-xr-xr-x 3 root root 0 Dec 31 1969 .
dr-xr-xr-x 3 root root 0 Dec 31 1969 ..
dr-xr-xr-x 3 root root 0 Dec 31 1969 vscode-insiders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aah, gotcha. Pinning the directory it at the vscodeExtension
side as well as you suggested.
Tested, works as expected with both variations.
There are 2 ways to get a vscodium with extensions: you can override the top-level vscode package to vscodium and then use vscode-with-extensions, or you can leave the toplevel vscode package as-is and override the vscode used in vscode-with-extensions. This modification makes the latter approach work without breaking the former.
586e344
to
06d0b27
Compare
Turns out there was already a PR fixing this - #71251 - that is now merged. Thanks @hyperfekt ! |
The extensions are in /share/vscode/extensions even for vscodium, and that
seems fine/convenient.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @Synthetica9