[Trigger] Type = Path Operation = Install Operation = Upgrade Operation = Remove Target = usr/lib/modules/*/nvidia-drm* Target = usr/lib/modules/*/vmlinuz [Action] Description = Updating Kernel initcpios for Nvidia-DRM... Depends = mkinitcpio When = PostTransaction NeedsTargets Exec = /bin/sh -c 'while read -r trg; do case $trg in usr/lib/modules/*/vmlinuz) exit 0; esac; done; /usr/bin/mkinitcpio -P'
This is how
/usr/share/libalpm/hooks/90-nvidia-utils.hook should look like in order to avoid generating initcpio image(s) twice when updating both kernel(s) and Nvidia driver(s).
Inspired by this: NVIDIA - ArchWiki
I don’t fully understand how it works but I tested in in different combinations, and yes, this way it works correctly.