8 cfg = config.services.graphical-desktop;
9 xcfg = config.services.xserver;
10 dmcfg = config.services.displayManager;
14 services.graphical-desktop.enable =
15 lib.mkEnableOption "bits and pieces required for a graphical desktop session"
17 default = xcfg.enable || dmcfg.enable;
18 defaultText = lib.literalExpression "(config.services.xserver.enable || config.services.displayManager.enable)";
23 config = lib.mkIf cfg.enable {
24 # The default max inotify watches is 8192.
25 # Nowadays most apps require a good number of inotify watches,
26 # the value below is used by default on several other distros.
27 boot.kernel.sysctl = {
28 "fs.inotify.max_user_instances" = lib.mkDefault 524288;
29 "fs.inotify.max_user_watches" = lib.mkDefault 524288;
33 # localectl looks into 00-keyboard.conf
34 etc."X11/xorg.conf.d/00-keyboard.conf".text = ''
36 Identifier "Keyboard catchall"
38 Option "XkbModel" "${xcfg.xkb.model}"
39 Option "XkbLayout" "${xcfg.xkb.layout}"
40 Option "XkbOptions" "${xcfg.xkb.options}"
41 Option "XkbVariant" "${xcfg.xkb.variant}"
44 systemPackages = with pkgs; [
45 nixos-icons # needed for gnome and pantheon about dialog, nixos-manual and maybe more
50 fonts.enableDefaultPackages = lib.mkDefault true;
52 hardware.graphics.enable = lib.mkDefault true;
54 programs.gnupg.agent.pinentryPackage = lib.mkOverride 1100 pkgs.pinentry-gnome3;
56 services.speechd.enable = lib.mkDefault true;
59 enable = lib.mkDefault true;
60 pulse.enable = lib.mkDefault true;
61 alsa.enable = lib.mkDefault true;
64 systemd.defaultUnit = lib.mkIf (xcfg.autorun || dmcfg.enable) "graphical.target";
67 autostart.enable = true;