{ config, lib, pkgs, ... }: with lib; let cfg = config.modules.desktop; in { options.modules.desktop = { envProto = mkOption { type = types.nullOr (types.enum ["x11" "wayland"]); description = "What display protocol to use"; }; }; config = mkMerge [ { qt = { enable = true; platformTheme = "gnome"; style = "adwaita-dark"; }; modules.desktop.fonts.enable = true; modules.desktop.fonts.baseFonts = true; } (mkIf (cfg.envProto == "wayland") { environment.sessionVariables = { # magic environment variables that improve wayland compat NIXOS_OZONE_WL = "1"; _JAVA_AWT_WM_NONEREPARENTING = "1"; GDK_BACKEND = "wayland,x11"; ANKI_WAYLAND = "1"; ELECTRON_OZONE_PLATFORM_HINT = "wayland"; XDG_SESSION_TYPE = "wayland"; SDL_VIDEODRIVER = "wayland"; CLUTTER_BACKEND = "wayland"; }; }) (mkIf (cfg.envProto == "x11") { services.xserver.excludePackages = [ pkgs.xterm ]; }) ]; }