1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-26 03:39:47 +01:00
home-manager/tests/modules/services/activitywatch/basic-setup.nix
Robert Helgesson 9c1a1c7df4
activitywatch: reduce test closure
This also reduces test flakiness.
2024-10-17 15:30:02 +02:00

54 lines
1.7 KiB
Nix

{ config, ... }:
let stubPackage = config.lib.test.mkStubPackage { };
in {
services.activitywatch = {
enable = true;
package = stubPackage;
settings = {
port = 3012;
custom_static = { custom-watcher = stubPackage; };
};
watchers = {
# These are basically examples of a real world usage.
aw-watcher-afk.package = stubPackage;
aw-watcher-window.package = stubPackage;
custom-watcher = {
package = stubPackage;
settings = {
foo = "bar";
baz = 8;
};
settingsFilename = "config.toml";
};
another-custom-watcher = {
package = stubPackage;
settings = {
hello = "there";
world = "plan";
};
};
};
};
nmt.script = ''
# Basic check for the bare setup.
assertFileExists home-files/.config/systemd/user/activitywatch.service
assertFileExists home-files/.config/systemd/user/activitywatch.target
# Basic check for the watchers setup.
assertFileExists home-files/.config/systemd/user/activitywatch-watcher-aw-watcher-afk.service
assertFileExists home-files/.config/systemd/user/activitywatch-watcher-aw-watcher-window.service
# Checking for the generated configurations (and the ones that is not
# supposed to exist).
assertFileExists home-files/.config/activitywatch/aw-server-rust/config.toml
assertFileExists home-files/.config/activitywatch/custom-watcher/config.toml
assertFileExists home-files/.config/activitywatch/another-custom-watcher/another-custom-watcher.toml
assertPathNotExists home-files/.config/activitywatch/aw-watcher-afk/aw-watcher-afk.toml
assertPathNotExists home-files/.config/activitywatch/aw-watcher-window/aw-watcher-window.toml
'';
}