{ pkgs, lib, config, ... }: let cfg = config._archetypes.collections.desktop.xserver; in { options._archetypes.collections.desktop.xserver = { enable = lib.mkEnableOption "installs xserver"; utilities.enable = lib.mkEnableOption "installs basic xserver utilities"; }; config = lib.mkIf cfg.enable { services = { xserver = { enable = true; displayManager.startx.enable = true; enableTearFree = true; }; libinput.enable = true; # Enable touchpad support }; # Install basic X utilities environment.systemPackages = with pkgs; lib.optionals cfg.utilities.enable [ unclutter-desktop-entry unclutter-xfixes xcape xclip xdotool xorg.setxkbmap xorg.xinput xorg.xkill xorg.xrandr xorg.xset xwallpaper ]; }; }