nixpkgs/pkgs
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
..
applications Merge pull request #42706 from r-ryantm/auto-update/gnucash 2018-07-01 19:58:58 +02:00
build-support fetchurl: add sageupstream mirror 2018-06-30 01:20:44 +02:00
common-updater
data elliptic_curves: init at 0.8 2018-06-30 01:20:45 +02:00
desktops nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME 2018-07-09 18:46:13 +02:00
development Merge pull request #42837 from ookhoi/anonscm.debian.org_gcc6.patch-not-found 2018-07-01 15:08:53 -04:00
games nethack: nethack-x11 package created 2018-06-30 14:48:20 +03:00
misc Merge pull request #41954 from jraygauthier/jrg/hplip_fixes_rebased 2018-06-29 09:17:50 +02:00
os-specific iwd: set statedir to /var/lib/iwd 2018-07-01 10:59:35 +01:00
servers dovecot: 2.3.1 -> 2.3.2, dovecot-pigeonhole: 0.5.1 -> 0.5.2 (#42779) 2018-06-30 13:41:39 +02:00
shells antibody: 3.5.0 -> 3.5.1 (#42818) 2018-06-30 19:05:28 +02:00
stdenv make-bootstrap-tools-cross: remove broken i686-musl variant 2018-06-25 11:16:10 -05:00
test Merge remote-tracking branch 'upstream/master' into staging 2018-06-18 15:30:39 -04:00
tools Merge pull request #42844 from dtzWill/fix/curl-random-cross 2018-07-01 13:32:40 -05:00
top-level ghc: add 8.6.1-alpha1 pre-release 2018-07-01 19:22:09 +02:00