mirror of
https://git.adityakumar.xyz/nix-conf.git
synced 2025-02-22 15:50:01 +00:00
32 lines
686 B
Nix
32 lines
686 B
Nix
{
|
|
config,
|
|
inputs,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: {
|
|
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";
|
|
};
|
|
};
|
|
};
|
|
}
|