vscode: save as root fixed

main
Pavel Shirshov 3 years ago
parent f6e9e908cc
commit ecf4ca4c23
  1. 15
      pkgs/applications/editors/vscode/generic.nix

@ -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;
};

Loading…
Cancel
Save