diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 1be02659..c6c5904a 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -269,8 +269,9 @@ let checkPhase = lib.optionalString cfg.checkConfig '' export DBUS_SESSION_BUS_ADDRESS=/dev/null export XDG_RUNTIME_DIR=$(mktemp -d) + cp "$target" sway.conf ${cfg.preCheckConfig} - ${pkgs.xvfb-run}/bin/xvfb-run ${swayPackage}/bin/sway --config "$target" --validate --unsupported-gpu + ${pkgs.xvfb-run}/bin/xvfb-run ${swayPackage}/bin/sway --config sway.conf --validate --unsupported-gpu ''; text = concatStringsSep "\n" @@ -483,12 +484,15 @@ in { type = types.lines; default = ""; example = '' + sed 's/foo/bar/g' -i sway.conf export HOME=$(mktemp -d) touch ~/background.png ''; description = '' Script to run before running `sway --validate` on the generated config - file. Only used if `checkConfig = true`. + file. The config file is available as `sway.conf`, and can be + manipulated without affecting the build output. Only used if + `checkConfig = true`. ''; }; diff --git a/tests/modules/services/window-managers/sway/sway-check-config-precheck.nix b/tests/modules/services/window-managers/sway/sway-check-config-precheck.nix index a7aeb1b9..77ae2f1d 100644 --- a/tests/modules/services/window-managers/sway/sway-check-config-precheck.nix +++ b/tests/modules/services/window-managers/sway/sway-check-config-precheck.nix @@ -6,12 +6,15 @@ lib.mkIf config.test.enableBig { checkConfig = true; preCheckConfig = '' export HOME=$(mktemp -d) - touch ~/mybg.png + sed 's/mybg/otherbg/g' -i sway.conf + touch ~/otherbg.png ''; config.output."*".background = "~/mybg.png fill"; }; nmt.script = '' assertFileExists home-files/.config/sway/config + assertFileRegex home-files/.config/sway/config 'mybg\.png' + assertFileNotRegex home-files/.config/sway/config 'otherbg\.png' ''; }