In addition to the above, let me chime in on the specific questions:
If you check the version of the current package in nixpkgs stable, it’s 570.153.02 (may change, new versions have been released since, though until nvidia stop supporting your GPU you’ll be fine, and if nvidia do stop supporting it you likely won’t be hit until the next NixOS release).
You can use that number to find the supported GPUs here: Appendix A. Supported NVIDIA GPU Products
The 940MX is in that list, so you can safely leave the package option unset. All of the important wayland features have long since landed in the default driver, there is currently no reason to follow their beta branch for your average consumer.
As for the open (official, non-nouveau, recommended by nvidia) module, unfortunately that only supports Turing or newer, which the 940MX is not. This means some features will be missing: Chapter 44. Open Linux Kernel Modules
It also means you should set hardware.nvidia.open = false;.
Yes. Bumblebee is an ancient thing, ignore it. You need prime.
That said, I’d start with setting up just the nvidia driver. Once that’s confirmed to work, using prime is just a few tweaks away.
There is to my knowledge no adequate guide on making prime work with wayland yet, and as far as I know no DEs shipped with NixOS support X11 anymore.
To get it working in general, you need to do what these two modules do:
The code uses some neat nix features to be really generic, I’d be happy to translate that to something simpler if you tell us what desktop you’re running.
When set up, you then need to use the nvidia-offload utility to start any application you want to run on your discrete GPU (or use launchers and such that set the special environment variables for you).
Additionally, you probably want to enable dynamicBoost.
See the above. YMMV, if it doesn’t work, share your full configuration.
See above on prime.