1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00
home-manager/tests/modules/services/espanso/linux/basic-configuration.nix
Austin Horstman b4752b0eda treewide: format with latest stable formatter
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-07-23 10:27:52 -05:00

67 lines
1.8 KiB
Nix

espansoExtraArgs: {
services.espanso = {
enable = true;
configs = {
default = {
show_notifications = false;
};
};
matches = {
base = {
matches = [
{
trigger = ":now";
replace = "It's {{currentdate}} {{currenttime}}";
}
{
trigger = ":hello";
replace = ''
line1
line2'';
}
{
regex = ":hi(?P<person>.*)\\.";
replace = "Hi {{person}}!";
}
];
global_vars = [
{
name = "currentdate";
type = "date";
params = {
format = "%d/%m/%Y";
};
}
{
name = "currenttime";
type = "date";
params = {
format = "%R";
};
}
];
};
};
}
// espansoExtraArgs;
nmt.script = ''
serviceFile=home-files/.config/systemd/user/espanso.service
expectedServiceFile=${./basic-configuration.service}
assertFileExists "$serviceFile"
# ensure espanso is in ExecStart
assertFileRegex "$serviceFile" 'ExecStart=.*/bin/espanso launcher'
# rest of the file should be identical
grep -v "/bin/espanso launcher" "$(_abs $serviceFile)" > espanso-service.actual
grep -v "/bin/espanso launcher" "$expectedServiceFile" > espanso-service.expected
assertFileContent "$(realpath espanso-service.actual)" espanso-service.expected
configFile=home-files/.config/espanso/config/default.yml
assertFileExists "$configFile"
assertFileContent "$configFile" ${./basic-configuration.yaml}
matchFile=home-files/.config/espanso/match/base.yml
assertFileExists "$matchFile"
assertFileContent "$matchFile" ${./basic-matches.yaml}
'';
}