Each night I run pacman -Qqen > pkglist.txt
When I rebuild from scratch, I use the following to pull down all the non-AUR packages.
The following line is the meat of the script as the remaining lines are either simple documentation or cosmetics like, this script is now complete - please reboot.
while read line; do pacman -S --needed --noconfirm $line; done < pkglist.txt
I also have a similar process for Debian. This cuts down on how long a rebuild takes and eliminates the forgotten packages that were installed.
it was DistroTube that introuced me to bare git repo for dotfiles… ever going back
and ansible is the best way to bring everything back to “normal”
in facts I have an alias for yay="echo Put it in ansible first" same for pacman
either could be run as \yay if you want to run the original system command.
I see many people suggesting pacman export-import but I could never deal with random configs; hence ansible
Also, just to trigger a conversation, you can use the same ansible ( mostly ) for any other Debian/RH/Arch base Distro