nixpkgs/nixos/modules
Ambroz Bizjak f26153754a nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME
This adds configuration options which automate the configuration of NVIDIA Optimus using PRIME. This allows using the NVIDIA proprietary driver on Optimus laptops, in order to render using the NVIDIA GPU while outputting to displays connected only to the integrated Intel GPU. It also adds an option for enabling kernel modesetting for the NVIDIA driver (via a kernel command line flag); this is particularly useful together with Optimus/PRIME because it fixes tearing on PRIME-connected screens.

The user still needs to enable the Optimus/PRIME feature and specify the bus IDs of the Intel and NVIDIA GPUs, but this is still much easier for users and more reliable. The implementation handles both the X configuration file as well as getting display managers to run certain necessary `xrandr` commands just after X has started.

Configuration of commands run after X startup is done using a new configuration option `services.xserver.displayManager.setupCommands`. Support for this option is implemented for LightDM, GDM and SDDM; all of these have been tested with this feature including logging into a Plasma session.

Note: support of `setupCommands` for GDM is implemented by making GDM run the session executable via a wrapper; the wrapper will run the `setupCommands` before execing. This seemed like the simplest and most reliable approach, and solves running these commands both for GDM's X server and user X servers (GDM starts separate X servers for itself and user sessions). An alternative approach would be with autostart files but that seems harder to set up and less reliable.

Note that some simple features for X configuration file generation (in `xserver.nix`) are added which are used in the implementation:
- `services.xserver.extraConfig`: Allows adding arbitrary new sections. This is used to add the Device section for the Intel GPU.
- `deviceSection` and `screenSection` within `services.xserver.drivers`. This allows the nvidia configuration module to add additional contents into the `Device` and `Screen` sections of the "nvidia" driver, and not into such sections for other drivers that may be enabled.
2018-07-09 18:46:13 +02:00
..
config nixos/no-x-libs: Switch to using nixpkgs.overlays 2018-06-11 20:58:33 +02:00
hardware nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME 2018-07-09 18:46:13 +02:00
i18n/input-method Merge pull request #42588 from laMudri/ibus-troubleshoot 2018-06-27 15:39:39 +01:00
installer not-detected: use lib.mkDefault 2018-06-17 23:25:41 +03:00
misc nixos/hadoop: add hadoop module (hdfs, yarn) 2018-06-29 23:14:02 -04:00
profiles nixos/installer: Drop dmraid 2018-05-25 01:55:51 +03:00
programs nixos/npm: add npm to the system closure by default (#42420) 2018-06-25 00:11:55 +02:00
security manual: Clarify that limits.conf doesn't apply to systemd services. (#40267) 2018-05-12 17:44:57 +02:00
services nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME 2018-07-09 18:46:13 +02:00
system networkmanager: Expand dns description, integrate with other services (#41898) 2018-06-29 13:41:46 -04:00
tasks nixos/zfs: load encryption keys for all pools (#41846) 2018-06-28 11:04:30 +01:00
testing nixos/tests: set default stateVersion in test VMs 2018-05-14 00:01:15 +02:00
virtualisation azure: stop carrying qemu-220 patch 2018-06-12 02:06:03 -07:00
module-list.nix Merge pull request #41381 from aespinosa/hadoop-modules 2018-06-30 18:33:03 -04:00
rename.nix Merge pull request #42133 from markuskowa/pgbackup 2018-06-20 22:21:52 +01:00