1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00
nixpkgs/nixos/modules/services/x11
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
..
desktop-managers Merge pull request #33371 from jtojnar/flatpak 2018-05-15 14:19:33 +02:00
display-managers nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME 2018-07-09 18:46:13 +02:00
hardware libinput: disableWhileTyping = false by default 2017-12-30 22:02:16 +00:00
window-managers nixos/awesome: Add noArgb option 2018-06-13 19:47:26 +02:00
colord.nix colord service: init 2016-03-11 01:58:40 +03:00
compton.nix compton: adding missing xr_glx_hybrid backend 2017-11-28 14:02:48 +01:00
fractalart.nix fractalart service: init, Generate wallpapers (#23231) 2017-11-13 19:56:08 +01:00
redshift.nix redshift: allow using geoclue2 loation provider 2017-10-21 22:34:14 +01:00
terminal-server.nix nixos: update default cases from KDM/KDE4 to SDDM/KDE5 2017-02-09 21:52:00 -05:00
unclutter-xfixes.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
unclutter.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
urxvtd.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
xautolock.nix nixos/xautolock: fix default defaults/examples, add assertions 2018-01-31 21:43:23 +01:00
xbanish.nix nixos/xsession: use graphical systemd user target 2017-05-29 15:05:28 +02:00
xfs.conf
xfs.nix jobs -> systemd.services 2016-01-07 06:39:06 +00:00
xserver.nix nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME 2018-07-09 18:46:13 +02:00