From 340571109101d87625c62770002f0b9f3193beac Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sun, 1 Feb 2026 19:19:27 -0800 Subject: [PATCH] nixos/xserver: abort when encountering unknown xorg drivers Instead of silently ignoring unknown X11 video drivers, fail immediately with a helpful error message. --- doc/release-notes/rl-2605.section.md | 2 ++ nixos/modules/services/x11/xserver.nix | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/release-notes/rl-2605.section.md b/doc/release-notes/rl-2605.section.md index a8c61bdc13ef..8a19d58d8f25 100644 --- a/doc/release-notes/rl-2605.section.md +++ b/doc/release-notes/rl-2605.section.md @@ -120,6 +120,8 @@ - `pocket-id` has been updated to version 2 that contains [breaking changes](https://pocket-id.org/docs/setup/major-releases/migrate-v2). +- `services.xserver` will now throw an error if an X11 driver specified in `videoDriver(s)` cannot be found. Previously, unknown drivers would be silently ignored. + - `asio` (standalone version of `boost::asio`) has been updated from 1.24.0 to 1.36.0. Some breaking changes were introduced between these two versions, and the one affected most was the removal of `asio::io_service` in favor of `asio::io_context` in 1.33.0. `asio_1_32_0` is retained for packages that have not completed migration. `asio_1_10` has been removed as no packages depend on it anymore. diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index d04d02660528..2a72d9cda542 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -829,7 +829,8 @@ in services.xserver.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ]; - # FIXME: somehow check for unknown driver names. + # We ignore unknown drivers here because they may be resolved by other modules (e.g., the Nvidia + # module). We assert that all specified drivers were eventually found in the assertions below. services.xserver.drivers = flip concatMap cfg.videoDrivers ( name: lib.optional (videoDrivers ? ${name}) ( @@ -861,7 +862,11 @@ in assertion = cfg.upscaleDefaultCursor -> cfg.dpi != null; message = "Specify `config.services.xserver.dpi` to upscale the default cursor."; } - ]; + ] + ++ map (driver: { + assertion = builtins.elem driver (builtins.catAttrs "name" cfg.drivers); + message = "Unknown X11 driver ‘${driver}’ specified in `services.xserver.videoDrivers`."; + }) cfg.videoDrivers; environment.etc = (optionalAttrs cfg.exportConfiguration {