Skip to content

Instantly share code, notes, and snippets.

@jchv
Last active September 18, 2020 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchv/bf3e327ef6071648e20715baad864984 to your computer and use it in GitHub Desktop.
Save jchv/bf3e327ef6071648e20715baad864984 to your computer and use it in GitHub Desktop.
Script for getting a good IDE experience for programming Wine under NixOS. Assumes you are in the Wine folder, and have a ../wine-build.
#!/bin/sh
set -e
if [ "$1" = "inside-nix-shell" ]; then
echo "Clearing clangd cache."
rm -f "compile_commands.json"
rm -rf ".clangd"
LIBEAR32="$(nix-build "<nixpkgs>" -A bear --argstr system i686-linux)/lib/bear/libear.so"
LIBEAR64="$(nix-build "<nixpkgs>" -A bear --argstr system x86_64-linux)/lib/bear/libear.so"
echo "Compiling wine."
(cd ../wine-build &&
../wine/configure &&
make clean &&
bear -o ../wine/compile_commands.json \
--libear="${LIBEAR32}:${LIBEAR64}" make -j32)
echo "Finished compiling wine."
echo "Installing clangd."
nix-env -iA nixos.clang-tools
echo "Executing VSCode."
exec code .
else
echo "Running self under nix-shell."
nix-shell '<nixpkgs>' -A wine --run "./nix-code.sh inside-nix-shell"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment