refactor: change to litterate config
Configuration is now held by the `.org` files. All `.nix` files are tangled from the org-mode files.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
#+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
|
||||
Reference in New Issue
Block a user