{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/42846","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/42846/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/42846/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/42846/events","html_url":"https://github.com/NixOS/nixpkgs/pull/42846","id":337317937,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4NTQwMTcz","number":42846,"title":"nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME","user":{"login":"ambrop72","id":2626481,"node_id":"MDQ6VXNlcjI2MjY0ODE=","avatar_url":"https://avatars2.githubusercontent.com/u/2626481?v=4","gravatar_id":"","url":"https://api.github.com/users/ambrop72","html_url":"https://github.com/ambrop72","followers_url":"https://api.github.com/users/ambrop72/followers","following_url":"https://api.github.com/users/ambrop72/following{/other_user}","gists_url":"https://api.github.com/users/ambrop72/gists{/gist_id}","starred_url":"https://api.github.com/users/ambrop72/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambrop72/subscriptions","organizations_url":"https://api.github.com/users/ambrop72/orgs","repos_url":"https://api.github.com/users/ambrop72/repos","events_url":"https://api.github.com/users/ambrop72/events{/privacy}","received_events_url":"https://api.github.com/users/ambrop72/received_events","type":"User","site_admin":false},"labels":[{"id":737642262,"node_id":"MDU6TGFiZWw3Mzc2NDIyNjI=","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/10.rebuild-darwin:%200","name":"10.rebuild-darwin: 0","color":"eeffee","default":false},{"id":731734101,"node_id":"MDU6TGFiZWw3MzE3MzQxMDE=","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/10.rebuild-linux:%2011-100","name":"10.rebuild-linux: 11-100","color":"fbca04","default":false},{"id":90420949,"node_id":"MDU6TGFiZWw5MDQyMDk0OQ==","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/6.topic:%20gnome3","name":"6.topic: gnome3","color":"fef2c0","default":false},{"id":60265212,"node_id":"MDU6TGFiZWw2MDI2NTIxMg==","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/6.topic:%20nixos","name":"6.topic: nixos","color":"fef2c0","default":false},{"id":290122884,"node_id":"MDU6TGFiZWwyOTAxMjI4ODQ=","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/8.has:%20module%20(update)","name":"8.has: module (update)","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/NixOS/nixpkgs/milestones/13","html_url":"https://github.com/NixOS/nixpkgs/milestone/13","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/milestones/13/labels","id":2676453,"node_id":"MDk6TWlsZXN0b25lMjY3NjQ1Mw==","number":13,"title":"18.09","description":"Nixpkgs/NixOS 18.09 stable release.\r\n\r\nRelease managers are @vcunat and @samueldr.","creator":{"login":"globin","id":1447245,"node_id":"MDQ6VXNlcjE0NDcyNDU=","avatar_url":"https://avatars3.githubusercontent.com/u/1447245?v=4","gravatar_id":"","url":"https://api.github.com/users/globin","html_url":"https://github.com/globin","followers_url":"https://api.github.com/users/globin/followers","following_url":"https://api.github.com/users/globin/following{/other_user}","gists_url":"https://api.github.com/users/globin/gists{/gist_id}","starred_url":"https://api.github.com/users/globin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/globin/subscriptions","organizations_url":"https://api.github.com/users/globin/orgs","repos_url":"https://api.github.com/users/globin/repos","events_url":"https://api.github.com/users/globin/events{/privacy}","received_events_url":"https://api.github.com/users/globin/received_events","type":"User","site_admin":false},"open_issues":112,"closed_issues":91,"state":"open","created_at":"2017-08-02T12:18:49Z","updated_at":"2018-10-04T02:55:56Z","due_on":"2018-09-27T07:00:00Z","closed_at":null},"comments":35,"created_at":"2018-07-01T20:04:24Z","updated_at":"2018-10-04T03:56:38Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/NixOS/nixpkgs/pulls/42846","html_url":"https://github.com/NixOS/nixpkgs/pull/42846","diff_url":"https://github.com/NixOS/nixpkgs/pull/42846.diff","patch_url":"https://github.com/NixOS/nixpkgs/pull/42846.patch"},"body":"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.\r\n\r\nThe 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.\r\n\r\nConfiguration 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.\r\n\r\nNote: 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.\r\n\r\nNote that some simple features for X configuration file generation (in `xserver.nix`) are added which are used in the implementation:\r\n- `services.xserver.extraConfig`: Allows adding arbitrary new sections. This is used to add the Device section for the Intel GPU.\r\n- `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.\r\n\r\n###### Motivation for this change\r\n\r\nSetup of Optimus laptops is extremely hard and error-prone and in grave need of automation. Many users probably just give up even though Optimus laptops are technically supported by the NVIDIA driver via this setup.\r\n\r\nIt would be good for others to do some extra testing before merging this:\r\n- On Optimus laptops.\r\n- On non-Optimus computers with NVIDIA cards (when this feature is off, I cannot test this).\r\n\r\nP.S. I am aware of Bumblebee but I never bothered with it. Do we need checks to prevent PRIME and Bumblebee being enabled at the same time?\r\n\r\n###### Things done\r\n\r\n<!-- Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers. -->\r\n\r\n- [x] Tested using sandboxing ([nix.useSandbox](http://nixos.org/nixos/manual/options.html#opt-nix.useSandbox) on NixOS, or option `sandbox` in [`nix.conf`](http://nixos.org/nix/manual/#sec-conf-file) on non-NixOS)\r\n- Built on platform(s)\r\n   - [x] NixOS\r\n   - [ ] macOS\r\n   - [ ] other Linux distributions\r\n- [ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))\r\n- [ ] Tested compilation of all pkgs that depend on this change using `nix-shell -p nox --run \"nox-review wip\"`\r\n- [ ] Tested execution of all binary files (usually in `./result/bin/`)\r\n- [ ] Determined the impact on package closure size (by running `nix path-info -S` before and after)\r\n- [x] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md).\r\n\r\n---\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/426877160","html_url":"https://github.com/NixOS/nixpkgs/pull/42846#issuecomment-426877160","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/42846","id":426877160,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjg3NzE2MA==","user":{"login":"matthewbauer","id":19036,"node_id":"MDQ6VXNlcjE5MDM2","avatar_url":"https://avatars0.githubusercontent.com/u/19036?v=4","gravatar_id":"","url":"https://api.github.com/users/matthewbauer","html_url":"https://github.com/matthewbauer","followers_url":"https://api.github.com/users/matthewbauer/followers","following_url":"https://api.github.com/users/matthewbauer/following{/other_user}","gists_url":"https://api.github.com/users/matthewbauer/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewbauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewbauer/subscriptions","organizations_url":"https://api.github.com/users/matthewbauer/orgs","repos_url":"https://api.github.com/users/matthewbauer/repos","events_url":"https://api.github.com/users/matthewbauer/events{/privacy}","received_events_url":"https://api.github.com/users/matthewbauer/received_events","type":"User","site_admin":false},"created_at":"2018-10-04T03:56:38Z","updated_at":"2018-10-04T03:56:38Z","author_association":"MEMBER","body":"I definitely agree this has been in the works a little too long. However, at some point we need to resolve the conflict between the naming schemes of all the nvidia stuff. That's been my main hesitancy so far. We can look into backporting this to 18.09 once that has been resolved. Besides naming though it looks to be a good addition."}}
{"actor":{"display_login":"matthewbauer"}}