summaryrefslogtreecommitdiff
path: root/archetypes/collections/desktop/xserver.nix
blob: 4cbdae8b0ed71e041d3f47bd6bf5e9951c1c03ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ 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;
		services.xserver.displayManager.startx.enable = true;
		services.libinput.enable = true;  # Enable touchpad support

		# Install basic X utilities
		environment.systemPackages = with pkgs; lib.optionals cfg.utilities.enable [
			unclutter
			xcape
			xclip
			xdotool
			xorg.setxkbmap
			xorg.xinput
			xorg.xkill
			xorg.xrandr
			xorg.xset
			xwallpaper
		];

		# Enable TearFree option by default
		# Not all video drivers support this option
		services.xserver.deviceSection = ''
			Option "TearFree" "true"
		'';
	};
}