at 25.11-pre 2.1 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 cfg = config.services.graphical-desktop; 9 xcfg = config.services.xserver; 10 dmcfg = config.services.displayManager; 11in 12{ 13 options = { 14 services.graphical-desktop.enable = 15 lib.mkEnableOption "bits and pieces required for a graphical desktop session" 16 // { 17 default = xcfg.enable || dmcfg.enable; 18 defaultText = lib.literalExpression "(config.services.xserver.enable || config.services.displayManager.enable)"; 19 internal = true; 20 }; 21 }; 22 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; 30 }; 31 32 environment = { 33 # localectl looks into 00-keyboard.conf 34 etc."X11/xorg.conf.d/00-keyboard.conf".text = '' 35 Section "InputClass" 36 Identifier "Keyboard catchall" 37 MatchIsKeyboard "on" 38 Option "XkbModel" "${xcfg.xkb.model}" 39 Option "XkbLayout" "${xcfg.xkb.layout}" 40 Option "XkbOptions" "${xcfg.xkb.options}" 41 Option "XkbVariant" "${xcfg.xkb.variant}" 42 EndSection 43 ''; 44 systemPackages = with pkgs; [ 45 nixos-icons # needed for gnome and pantheon about dialog, nixos-manual and maybe more 46 xdg-utils 47 ]; 48 }; 49 50 fonts.enableDefaultPackages = lib.mkDefault true; 51 52 hardware.graphics.enable = lib.mkDefault true; 53 54 programs.gnupg.agent.pinentryPackage = lib.mkOverride 1100 pkgs.pinentry-gnome3; 55 56 services.speechd.enable = lib.mkDefault true; 57 58 services.pipewire = { 59 enable = lib.mkDefault true; 60 pulse.enable = lib.mkDefault true; 61 alsa.enable = lib.mkDefault true; 62 }; 63 64 systemd.defaultUnit = lib.mkIf (xcfg.autorun || dmcfg.enable) "graphical.target"; 65 66 xdg = { 67 autostart.enable = true; 68 menus.enable = true; 69 mime.enable = true; 70 icons.enable = true; 71 }; 72 }; 73}