Files
nix-config/modules/desktop/xserver.org
T
phundrak a3df5e937f refactor: change to litterate config
Configuration is now held by the `.org` files. All `.nix` files are
tangled from the org-mode files.
2026-10-26 00:43:40 +01:00

51 lines
1.1 KiB
Org Mode
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#+title: X Server
#+setupfile: ../headers
* X Server
What’s left of =services.xserver= on my hosts now that GNOME runs on
Wayland: picking extra video drivers to load, and my own keyboard
layout. Here’s the skeleton of the =nixos.xserver= module.
#+begin_src nix :tangle yes
{
flake.modules.nixos.xserver = {
config,
lib,
...
}:
with lib; let
cfg = config.mySystem.desktop.xserver;
in {
<<options>>
<<config>>
};
}
#+end_src
** Declaring the Option
=videoDrivers= lets a host load extra X11 drivers, such as =amdgpu= on
the machine with an AMD GPU.
#+name: options
#+begin_src nix
options.mySystem.desktop.xserver.videoDrivers = mkOption {
type = types.listOf types.str;
default = [];
example = ["amdgpu"];
description = "Extra X11 video drivers to load";
};
#+end_src
** Enabling It
I use the same Bépo AFNOR keyboard layout everywhere, so it’s baked in
directly rather than exposed as an option.
#+name: config
#+begin_src nix
config.services.xserver = {
enable = true;
videoDrivers = cfg.videoDrivers;
xkb = {
layout = "fr";
variant = "bepo_afnor";
};
};
#+end_src