diff --git a/doc/release-notes/rl-2605.section.md b/doc/release-notes/rl-2605.section.md index be7d2c29cb56..10802b054ec7 100644 --- a/doc/release-notes/rl-2605.section.md +++ b/doc/release-notes/rl-2605.section.md @@ -126,6 +126,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 89174b6b9d98..fd52b0023d94 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -830,7 +830,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}) ( @@ -862,7 +863,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 {