That's the standard build script setting the required compiler flags. Pretty mundane stuff, and nothing "inelegant" about it. It's not something Nix users or packagers need to even care about.
While the code is mundane and might not score any beauty points, it does offer a clear technical advantage. Namely, Nix doesn't require that packagers uniquely choose the installation path for each package. Instead, Nix guarantees that different package definitions result in a different installation path. This is one of the things that make Nix package definitions programmable because packagers don't have to manually resolve path conflicts.
Programmable package definitions mean more automation and customizability.
I rather have a kernel-level filesystem remapper.