Last active
          September 17, 2022 10:39 
        
      - 
      
 - 
        
Save fractal-fumbler/f80a8280475af236d1b7839ff28f9150 to your computer and use it in GitHub Desktop.  
    setting systemd-nspawn "container" for steam gaming in with amdgpu (archlinux)
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | mkdir gamecontainer | |
| sudo pacstrap -i -c gamecontainer base nano sudo bash-completion | |
| sudo arch-chroot gamecontainer | |
| useradd gamer | |
| passwd gamer | |
| mkdir /home/gamer | |
| chown -R gamer:gamer /home/gamer | |
| sed -i /etc/sudoers -re 's/^# %sudo.*/gamer ALL=(ALL:ALL) ALL/g' | |
| sed -i /etc/sudoers -re 's/^root.*/root ALL=(ALL:ALL) NOPASSWD: ALL/g' | |
| sudo systemd-nspawn -bD gamecontainer -M "gamecontainer" | |
| ########## | |
| ##pacman## | |
| ########## | |
| sudo pacman-key --init | |
| sudo pacman-key --populate archlinux | |
| # allow for colored output in pacman.conf | |
| sudo sed -i "s/#Color/Color/" /etc/pacman.conf | |
| # uncomment multilib repo | |
| sudo sed -i '/#\[multilib\]/,/#Include = \/etc\/pacman.d\/mirrorlist/ s/#//' /etc/pacman.conf | |
| printf " \n[chaotic-aur]\n## By: GarudaLinux and Fosshost\nServer = https://builds.garudalinux.org/repos/\$repo/\$arch\n \ | |
| ## By: LordKitsuna\nServer = https://repo.kitsuna.net/\$arch\n" | sudo tee -a /etc/pacman.conf | |
| sudo pacman-key --keyserver hkp://keyserver.ubuntu.com -r 3056513887B78AEB 8A9E14A07010F7E3 | |
| sudo pacman-key --lsign-key 3056513887B78AEB | |
| sudo pacman-key --lsign-key 8A9E14A07010F7E3 | |
| sudo pacman -Sy chaotic-keyring | |
| sudo pacman-key --populate chaotic | |
| sudo pacman -S gedit steam steam-native-runtime mangohud-git lib32-mangohud-git mesa-tkg-git lib32-mesa-tkg-git \ | |
| lib32-vulkan-icd-loader vulkan-icd-loader wine-tkg-staging-fsync-git yay gamescope | |
| set +o posix | |
| ################### | |
| ##/etc/environment## | |
| ################### | |
| printf " \nDISPLAY=:0.0\nPULSE_SERVER=unix:/run/gamer/host/pulse/native\nXAUTHORITY=/tmp/container_xauth\n \ | |
| MESA_SHADER_CACHE_DISABLE=1\n#MESA_GLSL_CACHE_DIR=/home/gamer/mesa\nDRI_PRIME=/dev/dri/renderD128\n" | sudo tee -a /etc/environment | |
| ####### | |
| touch /tmp/container_xauth && xauth nextract - "$DISPLAY" | sed -e 's/^..../ffff/' | xauth -f /tmp/container_xauth nmerge - | |
| ####### | |
| sudo systemd-nspawn -bD gamecontainer -M "gamecontainer" \ | |
| --setenv=XAUTHORITY=/tmp/container_xauth --setenv=DISPLAY=$DISPLAY \ | |
| --setenv=PULSE_SERVER=unix:/run/user/host/pulse/native \ | |
| --capability=all --volatile=no --property=CPUQuota=600% \ | |
| --bind=/dev/snd --bind=/dev/kvm --bind=/dev/dri/ --bind=/proc/asound \ | |
| --bind=/tmp/.X11-unix --bind=/tmp/container_xauth --bind=/proc/devices \ | |
| --bind=/dev/shm --property="DeviceAllow=/dev/shm rwm" \ | |
| --property="DeviceAllow=/dev/kvm" --property="DeviceAllow=/dev/dri/render128" \ | |
| --property="DeviceAllow=char-usb_device rwm" --property="DeviceAllow=char-input rwm" \ | |
| --property="DeviceAllow=char-alsa rwm" --property="DeviceAllow=char-drm rwm" \ | |
| --bind=/run/user/1000/pulse:/run/user/host/pulse \ | |
| --bind=/run/media/steam_linux:/home/user/steam/steam_linux \ | |
| --bind=/run/media/steam_proton:/home/user/steam/steam_proton \ | |
| --bind=/run/media/Games:/home/user/Games | |
| ####### | |
| machinectl shell user@gamecontainer | |
| ###### | |
| DRI_PRIME=/dev/dri/renderD128 -- render-node instead of the full graphics card interface. | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment