1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-01 01:51:24 +00:00
nixpkgs/nixos/modules/services
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
..
admin nixos/oxidized: add module 2018-05-24 04:40:45 +02:00
amqp
audio mpd: fix spelling in description 2018-06-03 09:55:26 +02:00
backup Merge pull request #41343 from jerith666/restic-s3 2018-06-28 20:43:41 -04:00
cluster nixos/hadoop: add hadoop module (hdfs, yarn) 2018-06-29 23:14:02 -04:00
computing nixos/slurm: remove propagatedBuidInputs from slurmWrapped 2018-06-02 14:01:24 +02:00
continuous-integration nixos/buildkite-agent: fix variable expansion in hook scripts 2018-04-27 12:17:40 +01:00
databases pgmanage: remove deprecated postage alias 2018-06-23 13:32:13 +02:00
desktops nixos/flatpak: add flatpak's XDG_DATA_DIRS to the environment 2018-05-22 02:26:21 +02:00
development bloop: init at 1.0.0-M11 2018-06-23 18:25:44 +02:00
editors Merge pull request #39478 from pngwjpgh/infinoted 2018-05-01 10:22:25 -05:00
games
hardware nixos/fwupd: Fix meta 2018-06-30 15:49:44 +02:00
logging nixos/journaldriver: add module for journaldriver log forwarder 2018-06-18 20:36:44 +02:00
mail opensmtpd module: allow changing the package 2018-06-18 09:49:01 +02:00
misc Merge pull request #41478 from bluescreen303/docker-registry 2018-06-20 21:45:56 -04:00
monitoring Merge pull request #40028 from WilliButz/add-dnsmasq-exporter 2018-06-01 23:18:49 -04:00
network-filesystems openafs_1_8: init at 1.8.0 (#41889) 2018-06-30 00:34:35 +02:00
networking iwd: set statedir to /var/lib/iwd 2018-07-01 10:59:35 +01:00
printing nixos/cupsd: Introduce services.printing.logLevel option 2018-04-27 16:41:49 +00:00
scheduling nixos/modules/services/scheduling/fcron: add setuid to fcrontab 2018-05-06 11:24:09 -07:00
search
security Merge pull request #41098 from mkaito/oauth2_proxy 2018-06-18 20:47:55 +03:00
system dbus: Add NSS modules path to dbus system bus service 2018-06-07 16:44:04 +02:00
torrent Merge pull request #33679 from flokli/deluge-module 2018-04-25 14:54:34 -05:00
ttys
web-apps Merge pull request #41444 from dasJ/tt-rss 2018-06-28 20:40:09 -04:00
web-servers Merge pull request #41799 from pacien/patch-4 2018-06-28 22:13:42 -04:00
x11 nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME 2018-07-09 18:46:13 +02:00