There are packages like arch-packer but it has few limitations/issues:
1. haven't been updated for 9 years
2. only supports Arch
3. supports pacaur for AUR (which I think should be configurable by user)
4. as far as I can tell, does not handle orphan packages
https://github.com/brotzeit/arch-packer
#Emacs