nix-conf/modules/home-manager/monitor/default.nix

33 lines
686 B
Nix
Raw Normal View History

2024-09-11 04:07:54 +00:00
{
config,
2024-09-11 05:09:42 +00:00
inputs,
2024-09-11 04:07:54 +00:00
lib,
2024-09-11 05:09:42 +00:00
pkgs,
2024-09-11 04:07:54 +00:00
...
}: {
options = {
monitor.enable = lib.mkEnableOption "enable monitor";
};
config = lib.mkIf config.monitor.enable {
systemd.user.timers.monitor = {
Install.WantedBy = [ "timers.target" ];
Timer = {
OnBootSec = "1m";
OnUnitActiveSec = "1m";
Unit = "monitor.service";
};
};
systemd.user.services.monitor = {
Unit = {
Description = "A script to monitor websites.";
};
Install = {
WantedBy = [ "default.target" ];
};
Service = {
ExecStart = "${inputs.monitor.packages.${pkgs.system}.default}/bin/monitor";
};
};
};
}