Cabal has had nix-style local builds since 2016:
That's a bug not a feature.
Every language these days is trying to force you to use its own badly-implemented imitation of Nix. Just look at what cargo does with the target/ directory and wonky "build fingerprints".
It's madness.