While working on #35098, I reviewed my notes regarding a few minor Guix script flaws and decided to address them here.
This PR:
Removes unused code.
Reduces code duplication.
Improves consistency across function usage.
Minimizes ShellCheck directive usage.