Add nvidia driver rolling package

Both points are eligible and yes i understand this view. I believe that can be done in 2 pacman hocks in theory.

Lets say:

  1. a new mhwd profile will be installed: nvidia-450 is installed… new one is nvidia-455
  2. If the hock detects a newer profile before upgrading it will delete the current driver
  3. Then after installing the new profile, mhwd will with a second hook install the new driver
  4. dependencies like cuda or nvtop need then to be installed with “–asexplicit” so that it won’t bother, that can also be done with the first hock

I see also here: README.md · master · Applications / mhwd · GitLab that a similar idea is on the todolist:

  • don’t remove packages on reinstallation…

Feel free to contribute there :wink:

just my first thoughts… guess this won’t be possible because you have to do system updates first to update mhwd for the new profile of the new driver to be even available to install. So detecting new nvidia drivers before system update is not possible.

Second thing is:
Will this be installable in an easy way for everyone? How do you tell noobs on how to install pacman hooks?
Also, how will they be updated, in case somthing in the logic changes?

I would still prefer an official, obvious way. Like another mhwd profile for a rolling driver.
Especially since I’m not the only one struggling with this.
See threads / quotes like this:

ok let’t get more productive. So you expect something like this, right?

The MHWDCONFIG looks like this for 455xx:

$ cat /var/lib/mhwd/db/pci/graphic_drivers/nvidia-latest/MHWDCONFIG 
# mhwd Driver Config

NAME="video-nvidia-latest"
INFO="Closed source NVIDIA drivers for linux."
VERSION="2020.10.04"
FREEDRIVER="false"
PRIORITY="10"

CLASSIDS="0300 0302"
VENDORIDS="10de"
DEVICEIDS=">/var/lib/mhwd/ids/pci/nvidia-latest.ids"

# Conflicts
CONFLICTS="nvidia-340xx-utils nvidia-390xx-utils nvidia-418xx-utils nvidia-430xx-utils nvidia-435xx-utils nvidia-440xx-utils nvidia-450xx-utils"
CONFLICTS_64="lib32-nvidia-340xx-utils lib32-nvidia-390xx-utils lib32-nvidia-418xx-utils lib32-nvidia-430xx-utils lib32-nvidia-435xx-utils lib32-nvidia-440xx-utils lib32-nvidia-450xx-utils"
CONKMOD="nvidia-340xx nvidia-390xx nvidia-418xx nvidia-430xx nvidia-435xx nvidia-440xx nvidia-450xx"

# Conflicts with other mhwd configs
MHWDCONFLICTS="video*nvidia-*"

# Dependencies
DEPENDS="nvidia-455xx-utils"
DEPENDS_64="lib32-nvidia-455xx-utils"
DEPKMOD="nvidia-455xx"

XORGFILE="/etc/X11/mhwd.d/nvidia.conf"
MHWDGPU_BLCKLSTNVIDIA="/etc/modprobe.d/mhwd-gpu.conf"
MHWDGPU_MODLDNVIDIA="/etc/modules-load.d/mhwd-gpu.conf"

fix_screen_flickering()
{
	sed -i /'Section "Device"'/,/'EndSection'/s/'EndSection'/"\tOption \"RegistryDwords\" \"PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefault=0x2; PowerMizerDefaultAC=0x1\"\nEndSection"/g "${XORGFILE}"
}

post_install()
{
	nvidia-xconfig -o "${XORGFILE}" --composite &>/dev/null
	MHWD_ADD_BACKSPACE "${XORGFILE}"

	# Remove logo
	sed -i /'Section "Device"'/,/'EndSection'/s/'EndSection'/"\tOption \"NoLogo\" \"1\"\nEndSection"/g "${XORGFILE}"

	# Fix screen flickering for some nvidia devices
	MHWD_FUNC_ON_MATCH 0300 10de "0400 0401 0402 0403 0407 0409 0425" fix_screen_flickering

	mhwd-gpu --setmod nvidia --setxorg "${XORGFILE}"

	# Without this 'glxgears' don't work in live-session
	MODULES_LOAD="/etc/modules-load.d"
	echo "nvidia-drm" >> "${MODULES_LOAD}/mhwd-gpu.conf"
	if [ ! "$(pgrep X)" ];	then
		modprobe nvidia-drm
	fi
}



post_remove()
{
	if [ -e "${XORGFILE}" ]; then
		rm "${XORGFILE}"
	fi

	if [ -f "${MHWDGPU_BLCKLSTNVIDIA}" ]; then
		sed -i '/^blacklist nouveau/d' "${MHWDGPU_BLCKLSTNVIDIA}"
		sed -i '/^blacklist ttm/d' "${MHWDGPU_BLCKLSTNVIDIA}"
		sed -i '/^blacklist drm_kms_helper/d' "${MHWDGPU_BLCKLSTNVIDIA}"
		sed -i '/^blacklist drm/d' "${MHWDGPU_BLCKLSTNVIDIA}"
	fi

	if [ -f "${MHWDGPU_MODLDNVIDIA}" ]; then
		sed -i '/^nvidia/d' "${MHWDGPU_MODLDNVIDIA}"
	fi

	mhwd-gpu --check
}

This is the mhwd database:

$ cat /var/lib/mhwd/ids/pci/nvidia-latest.ids
# List generated by mhwd. Do not edit manually.
0fc0 0fc1 0fc2 0fc6 0fc8 0fc9 0ff3 0ff9 0ffa 0ffd 0ffe 0fff 1001 1004 1005 1007 1008 100a 100c 1021 1022 1023 1024 1026 1027 1028 1029 102a 102d 103a 103c 1180 1183 1184 1185 1187 1188 1189 118a 118e 118f 1193 1194 1195 11b4 11ba 11c0 11c2 11c3 11c4 11c5 11c6 11c8 11cb 11fa 1280 1281 1282 1284 1286 1287 1288 1289 128b 1340 1341 1344 1346 1347 1348 1349 134b 134d 134e 134f 137b 1380 1381 1382 1390 1391 1392 1393 1398 1399 139a 139b 139c 139d 13b0 13b1 13b2 13b3 13b4 13b6 13b9 13ba 13bb 13bc 13c0 13c2 13d7 13d8 13d9 13da 13f0 13f1 13f2 13f3 13f8 13f9 13fa 13fb 1401 1402 1406 1407 1427 1430 1431 1436 15f0 15f7 15f8 15f9 1617 1618 1619 161a 1667 174d 174e 179c 17c2 17c8 17f0 17f1 17fd 1b00 1b02 1b06 1b30 1b38 1b80 1b81 1b82 1b83 1b84 1b87 1ba0 1ba1 1ba2 1bb0 1bb1 1bb3 1bb4 1bb5 1bb6 1bb7 1bb8 1bb9 1bbb 1bc7 1be0 1be1 1c02 1c03 1c04 1c06 1c07 1c09 1c20 1c21 1c22 1c23 1c30 1c31 1c60 1c61 1c62 1c81 1c82 1c83 1c8c 1c8d 1c8f 1c90 1c91 1c92 1c94 1c96 1cb1 1cb2 1cb3 1cb6 1cba 1cbb 1cbc 1cbd 1cfa 1cfb 1d01 1d10 1d11 1d12 1d13 1d16 1d33 1d34 1d52 1d81 1db1 1db3 1db4 1db5 1db6 1db7 1db8 1dba 1df0 1df2 1df5 1df6 1e02 1e04 1e07 1e30 1e36 1e81 1e82 1e84 1e87 1e89 1e90 1e91 1e93 1eb0 1eb1 1eb5 1eb6 1eb8 1ec2 1ec7 1ed0 1ed1 1ed3 1ef5 1f02 1f06 1f07 1f08 1f09 1f0a 1f10 1f11 1f12 1f14 1f15 1f36 1f42 1f47 1f50 1f51 1f54 1f55 1f76 1f82 1f91 1f95 1f96 1f97 1f98 1f99 1f9c 1fb8 1fb9 1ff9 20b0 2182 2184 2187 2188 2191 2192 21c4 21d1 2204 2206 1140 11a0 11b60

Et voila… that is mhwd with video-nvidia-latest :smiley:

Now the maintainer needs to fill this everytime with the latest driver… but this wont be updated to next version… it will stuck on 455… now create a meta package with the 455xx driver with a name video-nvidia-latest.

If you need this i can create a AUR package at least… xD

PS: The conflicts needs an update… at least some meta packages must be added in my opinion.