`stack setup` should not be called inside `nix-build` because
that makes stack download a GHC instead of using nix's one
(the one provided `generic-stack-builder.nix` as the `ghc` argument),
which will not work.
Further evidence for this is that the `stack --nix` support
intentionally uses `--system-ghc` for the same purpose.
generic-stack-builder was not setting STACK_PLATFORM_VARIANT="nix".
This is required by stack when handling its haskell packages database
snapshot. Stack must keep separated packages built with its own GHC
and those built with GHC from Nixpkgs.
Previously, the user could only compile using the default version of
GHC in Nixpkgs. Now this can be changed by setting the `ghc` attribute
appropriately.