diff options
| author | Bobby Rong <rjl931189261@126.com> | 2022-06-07 12:17:33 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-07 12:17:33 +0800 |
| commit | 877e24dac6687f24a1745af4f0f280ac10b5751d (patch) | |
| tree | f0aa9ce55fa46dae84d95a6472d6a930c0f44c6d | |
| parent | Merge pull request #176358 from LeSuisse/21.11-argocd-2.1.15 (diff) | |
| parent | vscode: fix auto encoding detection crashing editor window (diff) | |
| download | nixpkgs-877e24dac6687f24a1745af4f0f280ac10b5751d.tar.gz | |
Merge pull request #176357 from NixOS/backport-168882-to-release-21.11
[Backport release-21.11] vscode: fix auto encoding detection crashing editor window
| -rw-r--r-- | pkgs/applications/editors/vscode/generic.nix | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/applications/editors/vscode/generic.nix b/pkgs/applications/editors/vscode/generic.nix index a3b6b308db49..029d08a5c2e7 100644 --- a/pkgs/applications/editors/vscode/generic.nix +++ b/pkgs/applications/editors/vscode/generic.nix @@ -71,9 +71,9 @@ let buildInputs = [ libsecret libXScrnSaver libxshmfence ] ++ lib.optionals (!stdenv.isDarwin) ([ gtk2 at-spi2-atk ] ++ atomEnv.packages); - runtimeDependencies = lib.optional (stdenv.isLinux) [ (lib.getLib systemd) fontconfig.lib libdbusmenu ]; + runtimeDependencies = lib.optional stdenv.isLinux [ (lib.getLib systemd) fontconfig.lib libdbusmenu ]; - nativeBuildInputs = [unzip] ++ lib.optionals (!stdenv.isDarwin) [ autoPatchelfHook wrapGAppsHook ]; + nativeBuildInputs = [ unzip ] ++ lib.optionals stdenv.isLinux [ autoPatchelfHook nodePackages.asar wrapGAppsHook ]; dontBuild = true; dontConfigure = true; @@ -117,12 +117,18 @@ let # this is a fix for "save as root" functionality packed="resources/app/node_modules.asar" unpacked="resources/app/node_modules" - ${nodePackages.asar}/bin/asar extract "$packed" "$unpacked" + asar extract "$packed" "$unpacked" substituteInPlace $unpacked/@vscode/sudo-prompt/index.js \ --replace "/usr/bin/pkexec" "/run/wrappers/bin/pkexec" \ --replace "/bin/bash" "${bash}/bin/bash" rm -rf "$packed" + # without this symlink loading JsChardet, the library that is used for auto encoding detection when files.autoGuessEncoding is true, + # fails to load with: electron/js2c/renderer_init: Error: Cannot find module 'jschardet' + # and the window immediately closes which renders VSCode unusable + # see https://github.com/NixOS/nixpkgs/issues/152939 for full log + ln -rs "$unpacked" "$packed" + # this fixes bundled ripgrep chmod +x resources/app/node_modules/@vscode/ripgrep/bin/rg ''; |
