From c5c0459a60c1e64afc66c3b76434b88961d67abb Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Thu, 23 Mar 2017 20:06:52 +0000 Subject: [PATCH] xserver: check that selected layout exists Fixes #5638 --- nixos/modules/services/x11/xserver.nix | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 8438e6dcc702..2e2d567a060b 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -578,6 +578,35 @@ in services.xserver.xkbDir = mkDefault "${pkgs.xkeyboard_config}/etc/X11/xkb"; + system.extraDependencies = [ + (pkgs.runCommand "xkb-layouts-exist" { + layouts=cfg.layout; + } '' + missing=() + while read -d , layout + do + [[ -f "${cfg.xkbDir}/symbols/$layout" ]] || missing+=($layout) + done <<< "$layouts," + if [[ ''${#missing[@]} -eq 0 ]] + then + touch $out + exit 0 + fi + + cat >&2 <