Upgrade / nix-env -u always fails

I’m trying to update my Nix-packages (user packages on NixOS), but this always fails with:

$ nix-env -u
warning: unable to download 'https://cache.nixos.org/nar/....nar.xz': HTTP error 200 (curl error: Failure when receiving data from the peer); retrying in 309 ms
error 9 while decompressing xz file

If I start nix-env -u again, it aborts with the same error-message at an other nar.

What can I do to successfully upgrade?
And can this annoying behaviour of nix-env -u be fixed?

That’s most likely related to your internet connection and our CDN, see e.g. the end of this thread: The NixOS Cache is now hosted by Fastly!

@rkoe have a look at the Nix issue tracker, you’ll probably find existing issues with your problem: Issues · NixOS/nix · GitHub

Since Nix is working on many platforms it’s a good idea to report the Nix version and distribution it’s running under.