{ config, pkgs, ... }: { services.greetd = { enable = config.system.desktop.enable; restart = true; settings = { terminal = { vt = 2; switch = true; }; default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet"; }; }; environment.etc."greetd/environments".text = let initScript = '' if ${pkgs.pciutils}/bin/lspci -k | grep "in use: nvidia" &> /dev/null; then export LIBVA_DRIVER_NAME=nvidia export GBM_BACKEND=nvidia-drm export __GLX_VENDOR_LIBRARY_NAME=nvidia else : fi ''; in '' ${pkgs.writeScript "startsway" '' ${initScript} export QT_QPA_PLATFORM="wayland;xcb" export XDG_CURRENT_DESKTOP=sway sway --unsupported-gpu ''} ${pkgs.writeScript "startniri" '' ${initScript} export QT_QPA_PLATFORM=wayland export XDG_CURRENT_DESKTOP=niri niri-session ''} ''; }