{ pkgs, config, lib, myvars, ... }: with lib; let cfgWayland = config.modules.desktop.wayland; in { imports = [ ./base ../base ./desktop ]; options.modules.desktop = { wayland = { enable = mkEnableOption "Wayland Display Server"; }; }; config = mkMerge [ # Mesa userspace (OpenGL/Vulkan) for every GUI host. { hardware.graphics.enable = true; # Desktops opt in to the tracing/benchmark tooling and the # whole-filesystem `locate` index (both off by default; see # modules/nixos/base/{packages,locate}.nix). modules.debugTools.enable = true; modules.locate.enable = true; } (mkIf cfgWayland.enable { #################################################################### # NixOS's Configuration for Wayland based Window Manager #################################################################### services = { xserver.enable = false; # disable xorg server # https://wiki.archlinux.org/title/Greetd greetd = { enable = true; settings = { default_session = { # The Wayland session is installed for this user only, via home-manager. user = myvars.username; # .wayland-session is a script generated by home-manager, which links to the current wayland compositor(sway/hyprland or others). # with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config here. command = "${pkgs.tuigreet}/bin/tuigreet --time --cmd $HOME/.wayland-session"; # start wayland session with a TUI login manager # command = "$HOME/.wayland-session"; # start a wayland session directly without a login manager }; }; }; }; }) ]; }