Building kernel package: Wrong kernel after updating

(Qubes OS 4.2)
I’m trying to install the proprietary Nvidia driver following this guide:

and need to build the kernel package.
First I updated the kernel by issuing the command: sudo qubes-dom0-update kernel-latest.

The kernel has been updated to 6.9.7-1.qubes.fc37.x86_64 wich I can confirm with uname -r in dom0

Now when I boot I see 3 kernels:
6.9.7-1.qubes.fc37.x86_64
6.6.33-1.qubes.fc37_x86_64
6.6.21-1.qubes.fc37_x86_64

After this I downloaded a Fedora 37 template and created a Fedora 37 AppVM.
From a terminal a did:

enabled RPMFusion repository: sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpmhttps://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpmDownloaded packages: dnf download --resolve xorg-x11-drv-nvidia`

two of the packages download are
(4/71): kernel-devel-6.5.12-100.fc37.x86_64.rpm 1.6 MB/s | 19 MB 00:12
(68/71): kernel-devel-matched-6.5.12-100.fc37.x 1.0 MB/s | 149 kB 00:00
But this should be 6.9.7-1.qubes.fc37.x86_64 I guess?

dnf download --source nvidia-kmod

After downloading the packages I start with building the kernel package.
The tutorial tells me to install kernel-devel (matching my Qubes dom0 kernel, rpmbuild tool and kmodtool.
So I issue the command: sudo dnf install kernel-devel rpm-build kmodtool

I notice again the wrong kernel version:
Installing : kernel-devel-6.5.12-100.fc37.x86_64 29/55
Running scriptlet: kernel-devel-6.5.12-100.fc37.x86_64

After the installation of the packages has been completed I issue the command for building the kernel package:

rpmbuild --nodeps -D “kernels 6.9.7-1.qubes.fc37.x86_64” --rebuild nvidia-kmod-545.29.06-1.fc37.src.rpm

Installing nvidia-kmod-545.29.06-1.fc37.src.rpm
warning: nvidia-kmod-545.29.06-1.fc37.src.rpm: Header V4 RSA/SHA256 Signature, key ID 94843c65: NOKEY
warning: user mockbuild does not exist - using root
warning: group mock does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mock does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mock does not exist - using root
setting SOURCE_DATE_EPOCH=1700611200
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.fPzb9v

  • umask 022
  • cd /home/user/rpmbuild/BUILD
  • echo ‘kmodtool error: Don’'‘t know how to handle 6.9.7-1.qubes.fc37.x86_64 – /lib/modules/6.9.7-1.qubes.fc37.x86_64/source/Makefile not found’
    kmodtool error: Don’t know how to handle 6.9.7-1.qubes.fc37.x86_64 – /lib/modules/6.9.7-1.qubes.fc37.x86_64/source/Makefile not found
  • exit 2
    error: Bad exit status from /var/tmp/rpm-tmp.fPzb9v (%prep)

RPM build warnings:
nvidia-kmod-545.29.06-1.fc37.src.rpm: Header V4 RSA/SHA256 Signature, key ID 94843c65: NOKEY
user mockbuild does not exist - using root
group mock does not exist - using root
user mockbuild does not exist - using root
group mock does not exist - using root
user mockbuild does not exist - using root
group mock does not exist - using root

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.fPzb9v (%prep)

I went to /lib/modules/ but the directory of the actual kernel (6.9.7-1) is not there.
Only 6.3.4-101.fc37.x86_64 and 6.6.33-1.qubes.fc37.x86_64.

I went to the Qube settings to see which kernel the Qube is using:
Kernel: default (6.6.33-1.fc37) (current)
The other 3 options of the dropdown menu are:
6.6.21-1.fc37
6.6.33-1.fc37
(provided by qube)

But no 6.9.7-1.
I tried to install the kernel headers by issuing the command: sudo dnf install kernel-headers
Response:
Qubes OS Repository for Dom0
Package kernel-headers-6.5.4-100.fc37.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

How to solve this so I can build the correct kernel package for my actual kernel 6.9.7-1?
All help us much appreciated!

The packages kernel-qubes-vm and kernel-latest-qubes-vm are for domUs. See Managing VM kernel for more information.