Last active
September 18, 2020 07:08
-
-
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.
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
#!/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