1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8 xcfg = config.services.xserver;
9 dmcfg = config.services.displayManager;
10in
11{
12 config = lib.mkIf (xcfg.enable || dmcfg.enable) {
13 # The default max inotify watches is 8192.
14 # Nowadays most apps require a good number of inotify watches,
15 # the value below is used by default on several other distros.
16 boot.kernel.sysctl = {
17 "fs.inotify.max_user_instances" = lib.mkDefault 524288;
18 "fs.inotify.max_user_watches" = lib.mkDefault 524288;
19 };
20
21 environment = {
22 # localectl looks into 00-keyboard.conf
23 etc."X11/xorg.conf.d/00-keyboard.conf".text = ''
24 Section "InputClass"
25 Identifier "Keyboard catchall"
26 MatchIsKeyboard "on"
27 Option "XkbModel" "${xcfg.xkb.model}"
28 Option "XkbLayout" "${xcfg.xkb.layout}"
29 Option "XkbOptions" "${xcfg.xkb.options}"
30 Option "XkbVariant" "${xcfg.xkb.variant}"
31 EndSection
32 '';
33 systemPackages = with pkgs; [
34 nixos-icons # needed for gnome and pantheon about dialog, nixos-manual and maybe more
35 xdg-utils
36 ];
37 };
38
39 fonts.enableDefaultPackages = lib.mkDefault true;
40
41 hardware.opengl.enable = lib.mkDefault true;
42
43 programs.gnupg.agent.pinentryPackage = lib.mkOverride 1100 pkgs.pinentry-gnome3;
44
45 systemd.defaultUnit = lib.mkIf (xcfg.autorun || dmcfg.enable) "graphical.target";
46
47 xdg = {
48 autostart.enable = true;
49 menus.enable = true;
50 mime.enable = true;
51 icons.enable = true;
52 };
53 };
54}