nix: update to 24.11

Reviewed-on: https://codeberg.org/leana8959/.files/pulls/1
Co-authored-by: Léana 江 <leana.jiang+git@icloud.com>
Co-committed-by: Léana 江 <leana.jiang+git@icloud.com>
This commit is contained in:
Primrose 2024-11-30 18:42:54 +00:00 committed by Léana
parent 57ed96f0ea
commit f6a89cba08
60 changed files with 696 additions and 752 deletions

View file

@ -1,5 +1,3 @@
{ pkgs, lib, ... }:
{
systemd.sleep.extraConfig = ''
HibernateDelaySec=2hour
@ -24,32 +22,4 @@
SOUND_POWER_SAVE_CONTROLLER = "N";
};
};
systemd.services."battery-notify" = {
enable = true;
description = "Scream when battery is dying";
startAt = [ "*:0/5" ];
unitConfig.After = "multi-user.target";
serviceConfig.ExecStart =
let
script = pkgs.writeShellApplication {
name = "battery-notify";
runtimeInputs = [
pkgs.bc
pkgs.libnotify
];
text = ''
battery="/sys/class/power_supply/BAT1"
thres="0.2"
isLow=$(echo "($(cat $battery/energy_now) / $(cat $battery/energy_full)) < $thres" | bc -l)
if [ "$isLow" -eq 1 ]; then
echo "You're battery level is below $thres"
notify-send -u critical "Battery Low" "Please charge your battery"
fi
'';
};
in
lib.getExe script;
};
}