I want to make my laptop hibernate when battery is critically low but can’t find the config for that.
Maybe you could do the equivalent of this: https://wiki.archlinux.org/index.php/laptop#Hibernate_on_low_battery_level
The stockholm repository has something similar to what you are looking for, it is a module which provides the means to trigger actions for different power levels (e.g. between 25% and 15% or below 15%): https://git.shackspace.de/krebs/stockholm/blob/master/krebs/3modules/power-action.nix
This is how i use the module for my laptop:
If you do not want the full-fledge version then you can probably copy-paste the relevant parts into your config
Funny, just an hour ago I added code for that to my config.
But if your battery sends discharging events, you probably want a udev rule (as described in the arch wiki).
Great to learn about these. Thank you all.