[Feature Request] Include a pacman hook to regenerate NVIDIA CDI

Hi,

I would like to suggest providing a pacman hook to regenerate NVIDIA CDI whenever nvidia package upgrades. The pacman hook could be something like this:

[Trigger]
Operation = Upgrade
Type = Package
Target = nvidia

[Action]
Description = Regenerate NVIDIA CDI (Container Device Interface)
Exec = /usr/bin/nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
When = PostTransaction
Depends = nvidia-container-toolkit

The hook can be installed as

  1. directly to /usr/share/libalpm/hooks/nvidia-ctk-cdi.hook, which implies that /etc/cdi/nvidia.yaml is automatically overwrited whenever nvidia package is upgraded; however, an user might have manually modified the file.
  2. provided in /usr/share/nvidia-container-toolkit/nvidia-ctk-cdi.hook so that the user can choose to opt-in the hook (for instance, arch-audit provides such kind of hook)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information