This module provides a unified interface for enabling graphical environments across different types of hosts. It abstracts the differences between native Linux systems and WSL-based systems, allowing each host to declare only the desired mode.
- Provide a single entry point for enabling graphical environments
- Support both native Linux desktops and WSL environments
- Avoid duplicating graphical configuration across hosts
- Allow per-host customization of keyboard layout and fonts
This module is imported by all hosts, but only activates when graphical.enable = true.
Designed for Windows Subsystem for Linux:
- Does not enable X11 or Wayland
- Does not enable SDDM or Plasma
- Integrates with Windows graphical stack
- Allows keyboard and font configuration
- Minimal overhead
Use this mode when running NixOS inside WSL.
Full graphical environment for native Linux systems:
- Enables X11 (
services.xserver.enable = true) - Configures keyboard layout and variant
- Enables SDDM display manager
- Enables Plasma 6 desktop environment
- Enables Pipewire (ALSA, PulseAudio, JACK)
- Installs fonts declared in
graphical.fonts
Use this mode for laptops, desktops, or servers with a GUI.
Enables the graphical module. If false, no graphical services are configured.
Determines the graphical environment type.
"WSL" | "Linux"
Defaults to "Linux".
Keyboard layout (XKB layout). Defaults to "us".
Keyboard layout variant. Defaults to "altgr-intl".
List of font package names to install.
Example:
graphical.fonts = [ "hack-font" "noto-fonts" ];| Mode | X11 | SDDM | Plasma | Pipewire | Fonts | Keyboard |
|---|---|---|---|---|---|---|
| WSL | ❌ | ❌ | ❌ | ❌ | ✔️ | ✔️ |
| Linux | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
{pkgs, ...}: {
# ... other host configurations ...
graphical = {
enable = true;
mode = "WSL";
};
# ... other host configurations ...
}{pkgs, ...}: {
# ... other host configurations ...
graphical = {
enable = true;
mode = "Linux";
keymap = "us";
variant = "altgr-intl";
fonts = [ "hack-font" "noto-fonts" ];
};
# ... other host configurations ...
}Use it when:
- A host needs a graphical environment
- You want consistent configuration across machines
- You want to avoid duplicating X11/Plasma/SDDM setup
Do not use it for:
- Headless servers
- Containers
- Remote-only machines
- This module does not install X servers for WSL.
- It assumes Plasma 6 as the default desktop environment.
- Fonts must be provided as package names available in
pkgs.