Recreating MacBook Charge Control on NixOS

After replacing the battery in my 2015 MacBook Pro, I wanted NixOS to stop holding it at 100 percent charge all day.

macOS has proprietary battery-health and optimized-charging behavior. I did not try to reproduce Apple’s prediction model.

I built a deterministic alternative: 80 percent normally, 100 percent after unplugging for travel, then back to 80.

Read more...