Pin Virtualbox Version

I need Virtualbox for work and while it works perfectly I have some problems because it gets rebuilt quite often which takes a long time. So I thought I could just pin the version but I haven’t gotten it to work. I use the following config to install Virtualbox:

  virtualisation.virtualbox.host.enable = true;
  virtualisation.virtualbox.host.enableExtensionPack = true;
  virtualisation.virtualbox.guest.x11 = true;

If someone could give me some pointers or even a whole working config with a specific version pinned I would be very grateful! I’m quite new to NixOS and I’d like to keep my config simple and stupid and I’d rather not use flakes. I’ve already searched the Wiki/Discourse and while I did find some other people mentioning the same issue I haven’t found a solution that I understand.

Thanks a lot for your time!

If you pin virtualbox, you will also need to pin the kernel because it compiles some kernel modules. If you update your kernel, you will always need to rebuild the vboxdrv modules.