Correct approach to build and install kernel drivers


In our lab we are using a PCIe card to generate RF signals.

The company provides some scripts to build a Linux kernel module. Building and loading the Linux module requires root privileges but pkgs.stdenv.mkDerivation runs in a chroot environment.

What would be the correct approach to build and install these drivers?

Should one export an install script which the user can run in their dev shell, or should one expect the user to install these drivers beforehand?