I think I’ve found a workaround: I disabled nvidia-suspend, nvidia-hibernate and nvidia-resume and I’ve edited the /lib/systemd/system-sleep/nvidia as follows:
#!/bin/sh
case "$1" in
pre)
case "$SYSTEMD_SLEEP_ACTION" in
suspend|hibernate)
/usr/bin/nvidia-sleep.sh "$SYSTEMD_SLEEP_ACTION"
;;
suspend-after-failed-hibernate)
/usr/bin/nvidia-sleep.sh "suspend"
;;
esac
;;
post)
/usr/bin/nvidia-sleep.sh "resume"
;;
esac
Following systemd’s documentation, I’ve found out that all the executables in /lib/systemd/system-sleep/ are run before entering sleep mode, and the first argument passed is either “pre” or “post”: therefore, when it’s “post” I simply call nvidia-sleep.sh with the “resume” argument while when it’s “pre” I call it with the value of the SYSTEMD_SLEEP_ACTION variable.
It feels like an hack but it works, should I consider this solved?