Created
February 9, 2020 01:38
-
-
Save sonowz/d70b03177c344f4bbbc674de5e5bb937 to your computer and use it in GitHub Desktop.
Fix vscode remote error when doing SSH into NixOS machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
let | |
pname = "fix-vscode-remote"; | |
script = pkgs.writeShellScriptBin pname '' | |
if [ -z "$1" ]; then | |
echo "Please specify username." | |
exit 1 | |
fi | |
VSCODE_DIR="/home/$1/.vscode-server/bin" | |
SCRIPT_DIR="$(dirname $0)" | |
for versiondir in $VSCODE_DIR/*/; do | |
rm "$versiondir/node" | |
ln -s "$SCRIPT_DIR/node" "$versiondir/node" | |
done | |
''; | |
in | |
{}: | |
stdenv.mkDerivation rec { | |
name = pname; | |
nodePackage = nodejs-12_x; # This is vscode runtime | |
src = ./.; | |
installPhase = '' | |
mkdir -p $out/bin | |
cp ${script}/bin/${pname} $out/bin/${pname} | |
cp ${nodePackage}/bin/node $out/bin/node | |
chmod +x $out/bin/${pname} | |
''; | |
buildInputs = [ script nodePackage ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment