Qemu. problem with mouse forwarding in a virtual machine

Hey, everybody. Suddenly I’ve run into a common problem. After installing a guest system(FreeBSD 13.2) in qemu, the mouse and keyboard don’t work. The mouse cursor is in the center of the screen. Trying to enable the mouse via virtual machine manager results in error 8.

According to internet search results this is quite a common problem, but none of the solutions gave any results. I have added the user to the libvirt and kvm groups .

I have enabled mouse virtualization in configuration.nix.

 #Enable virtualisation
  boot.kernelModules = [ "kvm-amd" ];
  virtualisation.libvirtd.enable = true;
  programs.dconf.enable = true;
  virtualisation.spiceUSBRedirection.enable = true;

The result is negative. My spec :NixOS 23.05 kernel 6.1.61 AMD Ryzen 5600H Nvidia 1650. I don’t use flakes and home-manager in my configuration.
Thanks in advance. Any help is welcome.