NixOS-Config/modules/system/programs/greetd/default.nix

40 lines
981 B
Nix
Raw Normal View History

{ config, pkgs, ... }:
2024-10-09 03:36:08 -04:00
{
services.greetd = {
enable = config.system.desktop.enable;
restart = true;
settings = {
terminal = {
vt = 2;
switch = true;
};
default_session.command = "${pkgs.cage}/bin/cage -d -m last ${pkgs.greetd.gtkgreet}/bin/gtkgreet";
2024-09-02 19:07:17 -04:00
};
};
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
''}
'';
2024-09-02 19:07:17 -04:00
}