diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2022-04-16 23:01:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-16 23:01:09 +0200 |
commit | 937a330ffffd3313c90ddbff89bce78edb4cf408 (patch) | |
tree | 2462947894f8a4b4f975fa1567ed53eab96cb54f | |
parent | 78f1e7248b395d5bfdb3341d32f2aebf30992218 (diff) | |
parent | 2ca1c986175e864bb67a955a4189f7acf51f8b1b (diff) |
Merge pull request #168882 from SuperSandro2000/vscode
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 d704497b4f0c7..9a4f1b92d41ff 100644 --- a/pkgs/applications/editors/vscode/generic.nix +++ b/pkgs/applications/editors/vscode/generic.nix @@ -66,9 +66,9 @@ let buildInputs = [ libsecret libXScrnSaver libxshmfence ] ++ lib.optionals (!stdenv.isDarwin) ([ 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; @@ -114,12 +114,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 ''; |