Merge pull request #137912 from pshirshov/wip/vscode-sudo-fix

This commit is contained in:
Artturi 2021-09-16 17:17:38 +03:00 committed by GitHub
commit 5c2f59ce3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,9 @@
# Populate passthru.tests
, tests
# needed to fix "Save as Root"
, nodePackages, bash
# Attributes inherit from specific versions
, version, src, meta, sourceRoot
, executableName, longName, shortName, pname, updateScript
@ -108,6 +111,18 @@ let
)
'';
# See https://github.com/NixOS/nixpkgs/issues/49643#issuecomment-873853897
postPatch = ''
# 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"
substituteInPlace $unpacked/sudo-prompt/index.js \
--replace "/usr/bin/pkexec" "/run/wrappers/bin/pkexec" \
--replace "/bin/bash" "${bash}/bin/bash"
rm -rf "$packed"
'';
inherit meta;
};