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

authored by

Artturi and committed by
GitHub
5c2f59ce e5c5c3b1

+15
+15
pkgs/applications/editors/vscode/generic.nix
··· 7 7 # Populate passthru.tests 8 8 , tests 9 9 10 + # needed to fix "Save as Root" 11 + , nodePackages, bash 12 + 10 13 # Attributes inherit from specific versions 11 14 , version, src, meta, sourceRoot 12 15 , executableName, longName, shortName, pname, updateScript ··· 106 109 # Add gio to PATH so that moving files to the trash works when not using a desktop environment 107 110 --prefix PATH : ${glib.bin}/bin 108 111 ) 112 + ''; 113 + 114 + # See https://github.com/NixOS/nixpkgs/issues/49643#issuecomment-873853897 115 + postPatch = '' 116 + # this is a fix for "save as root" functionality 117 + packed="resources/app/node_modules.asar" 118 + unpacked="resources/app/node_modules" 119 + ${nodePackages.asar}/bin/asar extract "$packed" "$unpacked" 120 + substituteInPlace $unpacked/sudo-prompt/index.js \ 121 + --replace "/usr/bin/pkexec" "/run/wrappers/bin/pkexec" \ 122 + --replace "/bin/bash" "${bash}/bin/bash" 123 + rm -rf "$packed" 109 124 ''; 110 125 111 126 inherit meta;