Those are both things that a window manager doesnt really do. I havent used i3 much but ill try to point you in the right directions.
For caffeine, depending on your bar, i believe most of them have modules for that.
Then for locking/shutting down, you’d want to look at i3lock, xautolock, xidlehook, and probably many others. Can’t guide you to the right commands, but this forum thread seems to have a lot of the info you’re looking for: https://bbs.archlinux.org/viewtopic.php?id=208699
Im on my own NixOS journey right now, so i cant fully vouch for all this yet. Here are my bookmarks for Nix/NixOS learning resources:
Apart from all this, ive learned the most from a mix of looking at other people’s configurations and reading source code. The documentation is super messy, especially if you want to make use of flakes (which i personally recommend from the get go).
Imagine the reason you get caught doing something like this is because you bragged about it on a podcast