NixOS-Config/nixos/desktop/wayland.nix
2024-08-24 22:16:51 -04:00

64 lines
1.3 KiB
Nix

{pkgs, ...}: {
services = {
# Configure greetd for "auto" login (single user only)
greetd = let
startSway = pkgs.writeScript "startsway" ''
# Use NVIDIA variables if drivers are in use
if lspci -k | grep "Kernel driver in use: nvidia" &> /dev/null; then
# NVIDIA/AMD variables
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export WLR_NO_HARDWARE_CURSORS=1
else
:
fi
# Sway/Wayland
export XDG_CURRENT_DESKTOP=sway
export QT_QPA_PLATFORM="wayland;xcb"
# Start Sway
sway --unsupported-gpu
'';
in {
enable = true;
restart = true;
settings = {
terminal = {
vt = 2;
switch = true;
};
default_session = {
command = "${startSway}";
user = "jimbo";
};
};
};
dbus.enable = true;
};
programs.xwayland = {
enable = true;
};
# Enable backlight and theme control
programs = {
dconf.enable = true;
light.enable = true;
};
# Packages needed for Wayland
environment.systemPackages = with pkgs; [
wl-clipboard
wdisplays
clipman
libnotify
grim
slurp
swappy
jq
lm_sensors
];
}