Earlier quoted context omitted.
You can also go one step further and have the configuration for the entire OS in text files with something like NixOS. https://nixos.org/nixos/about.html Want to see what your PC was really like 2 months ago, including rolling back updates and removing new applications you installed and vice-versa? You can do that. Even if you switched desktop environments.
Can you get a Spacemacs setup working on NixOS, with layers and so on? In general, assuming one is willing to write a bit of glue code/NixOS versions of patches/ebuilds/PKGBUILDs, can one get one's configuration from $distro working on NixOS? I use Haskell, so I've been meaning to switch to Nix for a while.
I'm not familiar with ebuild or PKGBUILD. You'd probably have to rewrite them as Nix expressions.