From 676c0159ed51d10489a249ecdc61e115c2a90d03 Mon Sep 17 00:00:00 2001 From: Edwin Mackenzie-Owen Date: Wed, 24 Sep 2025 03:20:06 +0200 Subject: [PATCH] sway: print hint when checking the config file fails (#7665) --- modules/services/window-managers/i3-sway/sway.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 9303f8e0f..3fb08dfc8 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -429,7 +429,12 @@ let checkPhase = lib.optionalString cfg.checkConfig '' export DBUS_SESSION_BUS_ADDRESS=/dev/null export XDG_RUNTIME_DIR=$(mktemp -d) - ${pkgs.xvfb-run}/bin/xvfb-run ${cfg.package}/bin/sway --config "$target" --validate --unsupported-gpu + ${pkgs.xvfb-run}/bin/xvfb-run ${cfg.package}/bin/sway --config "$target" --validate --unsupported-gpu || { + echo "Checking the sway config file failed. Normally, this happens because there are errors in the config file." + echo "But the check can also fail if the sway config file has dependencies on configuration that is not available in the Nix build sandbox (e.g. custom keyboard layouts defined in the NixOS configuration; background images in the user's home directory)." + echo "In that case, it may be necessary to set 'wayland.windowManager.sway.checkConfig = false;'." + exit 1 + } ''; text = concatStringsSep "\n" (