@@ -88,11 +88,21 @@ in
8888 wayland = mkOption {
8989 default = true;
9090 description = ''
91− Allow GDM run on Wayland instead of Xserver
91+ Allow GDM to run on Wayland instead of Xserver.
92+ Note to enable Wayland with Nvidia you need to
93+ enable the <option>nvidiaWayland</option>.
9294 '';
9395 type = types.bool;
9496 };
9597
98+ nvidiaWayland = mkOption {
99+ default = false;
100+ description = ''
101+ Whether to allow wayland to be used with the proprietary
102+ NVidia graphics driver.
103+ '';
104+ };
105+
96106 autoSuspend = mkOption {
97107 default = true;
98108 description = ''
@@ -197,6 +207,17 @@ in
197207
198208 services.dbus.packages = [ gdm ];
199209
210+ # We duplicate upstream's udev rules manually to make wayland with nvidia configurable
211+ services.udev.extraRules = ''
212+ # disable Wayland on Cirrus chipsets
213+ ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="${gdm}/libexec/gdm-disable-wayland"
214+ # disable Wayland on Hi1710 chipsets
215+ ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="${gdm}/libexec/gdm-disable-wayland"
216+ ${optionalString (!cfg.gdm.nvidiaWayland) ''
217+ DRIVER=="nvidia", RUN+="${gdm}/libexec/gdm-disable-wayland"
218+ ''}
219+ '';
220+
200221 systemd.user.services.dbus.wantedBy = [ "default.target" ];
201222
202223 programs.dconf.profiles.gdm =