nix: don't use /tmp for the tests on darwin
Unlike on linux these are not namespaced per user so this will cause
build failures if /tmp/nix-test was not removed by a previous build if
the nixbld user id doesn't match by accident. Nix already creates a
unique tempdir for builds so we can use that instead.
Fixes #44172
(cherry picked from commit 77a9745d7ac675883fdbe8c448b5b94904cd2d2a)