diff --git a/profiles/pci/graphic_drivers/profiles.toml b/profiles/pci/graphic_drivers/profiles.toml index 07bb560..7a87f2e 100644 --- a/profiles/pci/graphic_drivers/profiles.toml +++ b/profiles/pci/graphic_drivers/profiles.toml @@ -48,9 +48,36 @@ conditional_packages = """ """ pre_install = """ - cat </etc/mkinitcpio.conf.d/10-chwd.conf + cat << 'EOF' | install -Dm644 /dev/stdin /etc/udev/rules.d/30-chwd-nvidia.rules # This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. -MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) +ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia_drm", TAG+="systemd", ENV{SYSTEMD_WANTS}+="nvidia-module-load.target" +EOF + + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/nvidia-module-load.target +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Description=NVIDIA module load target +Documentation=man:systemd.special(7) +JobTimeoutSec=10s + +# Make this a synchronization point on NVIDIA module load +After=sys-module-nvidia_drm.device +Wants=sys-module-nvidia_drm.device +EOF + + mkdir -p /etc/systemd/system/getty@.service.d /etc/systemd/system/display-manager.service.d + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/getty@.service.d/30-chwd-nvidia.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Wants=nvidia-module-load.target +After=nvidia-module-load.target +EOF + + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/display-manager.service.d/30-chwd-nvidia.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Wants=nvidia-module-load.target +After=nvidia-module-load.target EOF # Remove kms hook from mkinitcpio.conf on desktops @@ -92,6 +119,10 @@ EOF pre_remove = """ rm -f /etc/mkinitcpio.conf.d/10-chwd.conf rm -f /etc/mkinitcpio.conf.d/10-chwd-kms.conf + rm -f /etc/udev/rules.d/30-chwd-nvidia.rules + rm -f /etc/systemd/system/getty@.service.d/30-chwd-nvidia.conf + rm -f /etc/systemd/system/display-manager.service.d/30-chwd-nvidia.conf + rm -f /etc/systemd/system/nvidia-module-load.target """ post_remove = """ rm -f /etc/profile.d/nvidia-rtd3-workaround.sh @@ -313,6 +344,50 @@ if [ -z "$(lspci -d "10de:*:030x")" ]; then echo "opencl-mesa lib32-opencl-mesa" fi """ +pre_install = """ + cat << 'EOF' | install -Dm644 /dev/stdin /etc/udev/rules.d/30-chwd-amdgpu.rules +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +ACTION=="add", SUBSYSTEM=="module", KERNEL=="amdgpu", TAG+="systemd", ENV{SYSTEMD_WANTS}+="amdgpu-module-load.target" +EOF + + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/amdgpu-module-load.target +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Description=amdgpu module load target +Documentation=man:systemd.special(7) +JobTimeoutSec=10s + +# Make this a synchronization point on amdgpu module load +After=sys-module-amdgpu.device +Wants=sys-module-amdgpu.device +EOF + + mkdir -p /etc/systemd/system/getty@.service.d /etc/systemd/system/display-manager.service.d + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/getty@.service.d/30-chwd-amdgpu.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Wants=amdgpu-module-load.target +After=amdgpu-module-load.target +EOF + + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/display-manager.service.d/30-chwd-amdgpu.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Wants=amdgpu-module-load.target +After=amdgpu-module-load.target +EOF + + cat <<'EOF' >/etc/mkinitcpio.conf.d/10-chwd-amdgpu-kms.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +HOOKS=(${HOOKS[@]/kms/}) +EOF +""" +pre_remove = """ + rm -f /etc/udev/rules.d/30-chwd-amdgpu.rules + rm -f /etc/systemd/system/getty@.service.d/30-chwd-amdgpu.conf + rm -f /etc/systemd/system/display-manager.service.d/30-chwd-amdgpu.conf + rm -f /etc/systemd/system/amdgpu-module-load.target +""" [fallback] desc = 'Fallback profile'