Skip to content

Instantly share code, notes, and snippets.

@ivan
Created May 5, 2020 23:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan/90e6a44870862bc2da0ba5d91d12ee66 to your computer and use it in GitHub Desktop.
Save ivan/90e6a44870862bc2da0ba5d91d12ee66 to your computer and use it in GitHub Desktop.
Script to patch vscode-server and rust-analyzer to run on NixOS
#!/bin/sh
set -eu -o pipefail
# Patch the vscode-server node binary to run on NixOS.
#
# If this ever stops working, we could instead replace node with a corresponding version from nixkgs.
for i in ~/.vscode-server/bin/*/node; do
interpreter=$(patchelf --print-interpreter /run/current-system/sw/bin/sh)
patchelf --set-interpreter "$interpreter" "$i"
stdcpp_rpath=$(patchelf --print-rpath /run/current-system/sw/bin/node | tr ':' '\n' | grep gcc-)
patchelf --set-rpath "$stdcpp_rpath" "$i"
done
# Patch the rust-analyzer binary to run on NixOS
#
# https://github.com/rust-analyzer/rust-analyzer/pull/4157#issuecomment-623784773
patchelf --set-interpreter "$(patchelf --print-interpreter /run/current-system/sw/bin/sh)" ~/.vscode-server/data/User/globalStorage/matklad.rust-analyzer/rust-analyzer-linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment