Use mktemp for tempdir creation in prefetchers.

This incorporates the following two commits from <nixpkgs>:

NixOS/nixpkgs@f83af95f8a54d0375ac6e159b663de887ba5b6a6
NixOS/nixpkgs@5e7a1cf955e43e1fa3c1c157c0d6961e1bcf9801

Hydra was the original reason why I was fixing tempdir creation in the
first place. Seeing that Hydra ships its own versions of these scripts,
we need to patch them here as well.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>