nixos/graphical-desktop: extract generic graphical things from xserver

This is required to fix the keymap in SDDM without X.
This commit is contained in:
Sandro Jäckel 2024-03-24 16:51:18 +01:00
parent d220d8bb6f
commit 5598d81e94
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
3 changed files with 55 additions and 35 deletions

View File

@ -710,6 +710,7 @@
./services/misc/gogs.nix
./services/misc/gollum.nix
./services/misc/gpsd.nix
./services/misc/graphical-desktop.nix
./services/misc/greenclip.nix
./services/misc/guix
./services/misc/headphones.nix

View File

@ -0,0 +1,54 @@
{
config,
lib,
pkgs,
...
}:
let
xcfg = config.services.xserver;
dmcfg = config.services.displayManager;
in
{
config = lib.mkIf (xcfg.enable || dmcfg.enable) {
# The default max inotify watches is 8192.
# Nowadays most apps require a good number of inotify watches,
# the value below is used by default on several other distros.
boot.kernel.sysctl = {
"fs.inotify.max_user_instances" = lib.mkDefault 524288;
"fs.inotify.max_user_watches" = lib.mkDefault 524288;
};
environment = {
# localectl looks into 00-keyboard.conf
etc."X11/xorg.conf.d/00-keyboard.conf".text = ''
Section "InputClass"
Identifier "Keyboard catchall"
MatchIsKeyboard "on"
Option "XkbModel" "${xcfg.xkb.model}"
Option "XkbLayout" "${xcfg.xkb.layout}"
Option "XkbOptions" "${xcfg.xkb.options}"
Option "XkbVariant" "${xcfg.xkb.variant}"
EndSection
'';
systemPackages = with pkgs; [
nixos-icons # needed for gnome and pantheon about dialog, nixos-manual and maybe more
xdg-utils
];
};
fonts.enableDefaultPackages = lib.mkDefault true;
hardware.opengl.enable = lib.mkDefault true;
programs.gnupg.agent.pinentryPackage = lib.mkOverride 1100 pkgs.pinentry-gnome3;
systemd.defaultUnit = lib.mkIf (xcfg.autorun || dmcfg.enable) "graphical.target";
xdg = {
autostart.enable = true;
menus.enable = true;
mime.enable = true;
icons.enable = true;
};
};
}

View File

@ -651,8 +651,6 @@ in
|| config.services.greetd.enable);
in mkIf (default) (mkDefault true);
hardware.opengl.enable = mkDefault true;
services.xserver.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
# FIXME: somehow check for unknown driver names.
@ -686,19 +684,6 @@ in
# -xkbdir command line option does not seems to be passed to xkbcomp.
"X11/xkb".source = "${cfg.xkb.dir}";
})
# localectl looks into 00-keyboard.conf
//{
"X11/xorg.conf.d/00-keyboard.conf".text = ''
Section "InputClass"
Identifier "Keyboard catchall"
MatchIsKeyboard "on"
Option "XkbModel" "${cfg.xkb.model}"
Option "XkbLayout" "${cfg.xkb.layout}"
Option "XkbOptions" "${cfg.xkb.options}"
Option "XkbVariant" "${cfg.xkb.variant}"
EndSection
'';
}
# Needed since 1.18; see https://bugs.freedesktop.org/show_bug.cgi?id=89023#c5
// (let cfgPath = "X11/xorg.conf.d/10-evdev.conf"; in
{
@ -718,31 +703,12 @@ in
xorg.xprop
xorg.xauth
pkgs.xterm
pkgs.xdg-utils
xorg.xf86inputevdev.out # get evdev.4 man page
pkgs.nixos-icons # needed for gnome and pantheon about dialog, nixos-manual and maybe more
] config.services.xserver.excludePackages
++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh;
environment.pathsToLink = [ "/share/X11" ];
xdg = {
autostart.enable = true;
menus.enable = true;
mime.enable = true;
icons.enable = true;
};
# The default max inotify watches is 8192.
# Nowadays most apps require a good number of inotify watches,
# the value below is used by default on several other distros.
boot.kernel.sysctl."fs.inotify.max_user_instances" = mkDefault 524288;
boot.kernel.sysctl."fs.inotify.max_user_watches" = mkDefault 524288;
programs.gnupg.agent.pinentryPackage = lib.mkOverride 1100 pkgs.pinentry-gnome3;
systemd.defaultUnit = mkIf cfg.autorun "graphical.target";
systemd.services.display-manager =
{ description = "Display Manager";
@ -902,7 +868,6 @@ in
${cfg.extraConfig}
'';
fonts.enableDefaultPackages = mkDefault true;
fonts.packages = [
(if cfg.upscaleDefaultCursor then fontcursormisc_hidpi else pkgs.xorg.fontcursormisc)
pkgs.xorg.fontmiscmisc