# Based on previous attempts: # - # - { lib, gccStdenv, vscode-utils , jq, autoPatchelfHook, bash, makeWrapper , dotnet-sdk_3, curl, gcc, icu, libkrb5, libsecret, libunwind, libX11, lttng-ust, openssl, util-linux, zlib , desktop-file-utils, xprop, xsel }: with lib; let # https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/linux#install-prerequisites-manually libs = [ # .NET Core openssl libkrb5 zlib icu # Credential Storage libsecret # NodeJS libX11 # https://github.com/flathub/com.visualstudio.code.oss/issues/11#issuecomment-392709170 libunwind lttng-ust curl # General gcc.cc.lib util-linux # libuuid ]; in ((vscode-utils.override { stdenv = gccStdenv; }).buildVscodeMarketplaceExtension { mktplcRef = { name = "vsliveshare"; publisher = "ms-vsliveshare"; version = "1.0.4498"; sha256 = "01gg9jqkq9z05ckw0mnqfr769359j6h3z8ay6r17jj6m4mhy2m5g"; }; }).overrideAttrs({ nativeBuildInputs ? [], buildInputs ? [], ... }: { nativeBuildInputs = nativeBuildInputs ++ [ bash jq autoPatchelfHook makeWrapper ]; buildInputs = buildInputs ++ libs; # Using a patch file won't work, because the file changes too often, causing the patch to fail on most updates. # Rather than patching the calls to functions, we modify the functions to return what we want, # which is less likely to break in the future. postPatch = '' sed -i \ -e 's/updateExecutablePermissionsAsync() {/& return;/' \ -e 's/isInstallCorrupt(traceSource, manifest) {/& return false;/' \ out/prod/extension-prod.js declare ext_unique_id ext_unique_id="$(basename "$out")" # Fix extension attempting to write to 'modifiedInternalSettings.json'. # Move this write to the tmp directory indexed by the nix store basename. substituteInPlace out/prod/extension-prod.js \ --replace "path.resolve(constants_1.EXTENSION_ROOT_PATH, './modifiedInternalSettings.json')" \ "path.join(os.tmpdir(), '$ext_unique_id-modifiedInternalSettings.json')" # Fix extension attempting to write to 'vsls-agent.lock'. # Move this write to the tmp directory indexed by the nix store basename. substituteInPlace out/prod/extension-prod.js \ --replace "path + '.lock'" \ "__webpack_require__('path').join(__webpack_require__('os').tmpdir(), '$ext_unique_id-vsls-agent.lock')" # Hardcode executable paths echo '#!/bin/sh' >node_modules/@vsliveshare/vscode-launcher-linux/check-reqs.sh substituteInPlace node_modules/@vsliveshare/vscode-launcher-linux/install.sh \ --replace desktop-file-install ${desktop-file-utils}/bin/desktop-file-install substituteInPlace node_modules/@vsliveshare/vscode-launcher-linux/uninstall.sh \ --replace update-desktop-database ${desktop-file-utils}/bin/update-desktop-database substituteInPlace node_modules/@vsliveshare/vscode-launcher-linux/vsls-launcher \ --replace /bin/bash ${bash}/bin/bash substituteInPlace out/prod/extension-prod.js \ --replace xprop ${xprop}/bin/xprop \ --replace "'xsel'" "'${xsel}/bin/xsel'" ''; postInstall = '' cd $out/share/vscode/extensions/ms-vsliveshare.vsliveshare bash -s <