47 lines
1 KiB
Nix
47 lines
1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
{
|
|
options = {
|
|
custom.low-battery-notify.enable = lib.mkEnableOption "Enable low battery notification";
|
|
};
|
|
config = lib.mkIf config.custom.low-battery-notify.enable {
|
|
home.packages = with pkgs; [
|
|
python3
|
|
];
|
|
systemd.user = {
|
|
services = {
|
|
low-battery-notify = {
|
|
Unit = {
|
|
Description = "Low battery notify";
|
|
};
|
|
|
|
Service = {
|
|
Type = "oneshot";
|
|
ExecStart = "/home/flygrounder/.local/share/scripts/low-battery-notify.py";
|
|
};
|
|
};
|
|
};
|
|
timers = {
|
|
low-battery-notify = {
|
|
Unit = {
|
|
Description = "test";
|
|
};
|
|
|
|
Timer = {
|
|
OnUnitActiveSec = "10m";
|
|
OnBootSec = "10m";
|
|
};
|
|
|
|
Install = {
|
|
WantedBy = [ "timers.target" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
xdg.dataFile = {
|
|
low-battery-notify = {
|
|
source = ./script.py;
|
|
target = "scripts/low-battery-notify.py";
|
|
};
|
|
};
|
|
};
|
|
}
|