Assuming data is on separate partition or disk, I do nothing after an upgrade to older gear.
A new Mac, Brewfile and dotfiles in git
New Linux, I wrote a bash script years ago that just iterates over an array of pkg names as strings, then clone dotfiles. It checks for apt or pacman; there was a time where I couldn’t pick and kept going back and forth between Debian and Arch ️
For some reason I can’t bring myself to run Homebrew on Linux, even though I know it supports that OS now.