make cool-retro-term work with nvidia

This commit is contained in:
Andy 2017-01-24 20:03:42 +01:00
parent 27f89d7ed6
commit ecba7a40a9
Signed by: arno
GPG Key ID: 368DDA2E9A471EAC
2 changed files with 45 additions and 1 deletions

View File

@ -5,7 +5,13 @@ services:
image: andrey01/cool-retro-term
network_mode: bridge
devices:
- /dev/nvidia0
- /dev/nvidiactl
# - /dev/nvidia-uvm
# uncomment this when running NVIDIA Driver >= 361
# - /dev/nvidia-modeset
- /dev/dri
# - /dev/snd
# - /dev/video0
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:ro
@ -13,6 +19,22 @@ services:
- /etc/localtime:/etc/localtime:ro
- $HOME:/home/$USER
- /etc/machine-id:/etc/machine-id:ro
# Ubuntu's NVIDIA driver:
- /usr/lib/nvidia-361-prime:/h1_64:ro
- /usr/lib/nvidia-340:/h2_64:ro
- /usr/lib/nvidia-340-prime:/h3_64:ro
- /usr/lib/nvidia-304:/h4_64:ro
- /usr/lib32/nvidia-361:/h5_32:ro
- /usr/lib32/nvidia-340:/h6_32:ro
- /usr/lib32/nvidia-304:/h7_32:ro
# Ubuntu's generic libGL:
- /usr/lib/x86_64-linux-gnu:/h8_64:ro
- /usr/lib/i386-linux-gnu:/h9_32:ro
# openSUSE's NVIDIA driver:
- /usr/X11R6/lib:/h10_32:ro
- /usr/X11R6/lib64:/h11_64:ro
- /usr/lib:/h12_32:ro
- /usr/lib64:/h13_64:ro
environment:
- DISPLAY=unix$DISPLAY
- PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native

View File

@ -8,7 +8,29 @@ usermod --home /home/$USER $OLDUSER
usermod --login $USER $OLDUSER
echo "$USER ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/$USER
sudo PULSE_SERVER=${PULSE_SERVER:?} su -s /bin/bash -c /opt/cool-retro-term/cool-retro-term $USER
#
# Add a user to a detected "video" group
# so that it can access the nvidia devices
#
if [ -e /dev/nvidiactl ]; then
GID=$(stat -c '%g' /dev/nvidiactl)
groupadd -r -g $GID nvidia1
if [ $? -eq 0 ]; then
usermod -aG nvidia1 $USER
else
GROUP=$(stat -c '%G' /dev/nvidiactl)
usermod -aG $GROUP $USER
fi
fi
#
# Try to load host's libGL (generic or Nvidia 32/64-bit) drivers
#
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(echo /h{1..20}_{32,64} | tr ' ' ':')"
export LD_LIBRARY_PATH
sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH:?} PULSE_SERVER=${PULSE_SERVER:?} su -s /bin/bash -c /opt/cool-retro-term/cool-retro-term $USER
# QT_X11_NO_MITSHM - stops Qt form using the MIT-SHM X11 extension
# sudo QT_X11_NO_MITSHM=${QT_X11_NO_MITSHM:-1} PULSE_SERVER=${PULSE_SERVER:?} su -s /bin/bash -c /opt/cool-retro-term/cool-retro-term $USER