Skip to content

Commit

Permalink
Merge pull request #137912 from pshirshov/wip/vscode-sudo-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Artturin committed Sep 16, 2021
2 parents e5c5c3b + ecf4ca4 commit 5c2f59c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkgs/applications/editors/vscode/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
};

Expand Down

0 comments on commit 5c2f59c

Please sign in to comment.