sway: make it possible to alter conf in preCheckConfig
Some situations may require altering the config file itself to remove or adjust things. While this of course reduces the correctness of the check, it may be better to lose a little than be forced to disable the check altogether.
This commit is contained in:
parent
66a558e507
commit
5256fd07ba
|
@ -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`.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -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'
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue