Fix alacritty for ubuntu
This commit is contained in:
parent
11bd1d5d87
commit
570561ac73
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
alacrittyUnwrap = pkgs.writeShellScript "alacritty-unwrap" ''
|
alacrittyUnwrap = pkgs.writeShellScript "alacritty-unwrap" ''
|
||||||
unset LD_LIBRARY_PATH
|
unset LD_LIBRARY_PATH
|
||||||
|
unset LIBGL_DRIVERS_PATH
|
||||||
|
unset LIBVA_DRIVERS_PATH
|
||||||
unset __EGL_VENDOR_LIBRARY_DIRS
|
unset __EGL_VENDOR_LIBRARY_DIRS
|
||||||
exec "$@"
|
exec "$@"
|
||||||
'';
|
'';
|
||||||
@ -49,10 +51,36 @@
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
alacritty = pkgs.writeShellScriptBin "alacritty" ''
|
alacritty = pkgs.writeShellScriptBin "alacritty" ''
|
||||||
# TODO this might break things, especially if the machine is not using
|
set -e -x
|
||||||
# nvidia, but more investigation is needed. But it at least lets us get rid
|
|
||||||
# of nixGL.
|
host_ld_lib_path="$(
|
||||||
export LD_LIBRARY_PATH=/usr/lib
|
ldconfig -v 2>/dev/null \
|
||||||
|
| grep -v ^$'\t' \
|
||||||
|
| tr -s ':\n' ':' \
|
||||||
|
| head -c-1 \
|
||||||
|
)"
|
||||||
|
|
||||||
|
bin_ld_lib_path="$(
|
||||||
|
objdump -x ${pkgs.alacritty}/bin/alacritty \
|
||||||
|
| grep "RUNPATH" \
|
||||||
|
| awk '{print $2}' \
|
||||||
|
)"
|
||||||
|
|
||||||
|
host_dri_path="$(
|
||||||
|
echo "$host_ld_lib_path" \
|
||||||
|
| tr -s ':' '\n' \
|
||||||
|
| while read d; do if [ -d "$d/dri" ]; then echo "$d"/dri; fi; done \
|
||||||
|
| tr '\n' ':' \
|
||||||
|
| head -c-1
|
||||||
|
)"
|
||||||
|
|
||||||
|
# overwrite LD_LIBRARY_PATH such that the binary's ld search path is still
|
||||||
|
# searched first, but afterwards the host's ld search path is looked
|
||||||
|
# through. Similarly, the dri paths are set to be the hosts. This allows us
|
||||||
|
# to use the host's graphics drivers for alacritty.
|
||||||
|
export LD_LIBRARY_PATH="$bin_ld_lib_path":"$host_ld_lib_path"
|
||||||
|
export LIBGL_DRIVERS_PATH="$host_dri_path"
|
||||||
|
export LIBVA_DRIVERS_PATH="$host_dri_path"
|
||||||
export __EGL_VENDOR_LIBRARY_DIRS=/usr/share/glvnd/egl_vendor.d
|
export __EGL_VENDOR_LIBRARY_DIRS=/usr/share/glvnd/egl_vendor.d
|
||||||
|
|
||||||
exec ${pkgs.alacritty}/bin/alacritty \
|
exec ${pkgs.alacritty}/bin/alacritty \
|
||||||
|
Loading…
Reference in New Issue
Block a user