nixpkgs: Allow passing {host,build}Platform directly instead of *[sS]ystem
This new interface has already been applied successfully in NixOS.
`nixos-generate-hardware` has been generating the "default" hostPlatform
in `hardware-configuration.nix` for over a year now [without much trouble],
and with the benefit of not having to specify `system` (or similar) in
`nixosSystem` anymore.
Furthermore, the `hostPlatform` option is always defined and reliably
produces the host platform for users who don't use the legacy options.
This is in contrast to `nixpkgs.crossSystem`, which is usually not
even defined, and `nixpkgs.localSystem` which is usually the wrong
platform to refer to in a config file.
Ideally we'd clean up the `nixpkgs.{system,localSystem,crossSystem}`
options to reduce complexity and confusion. But the interface in
Nixpkgs is still based on the old terminology and behavior.
By introducing these parameters also in Nixpkgs, the users' experience
with NixOS carries over to Nixpkgs as well.
Further simplifications in the code base are now possible, specifically
- stage.nix and related files still work with {local,cross}System,
and have logic like
${if stdenv.hostPlatform == stdenv.buildPlatform
then "localSystem" else "crossSystem"} = <...>
... which is really just
hostPlatform = <...>
This can now be simplified by refactoring this code to work with
{host,build}Platform variables instead.
- NixOS can forward its platform options directly to its Nixpkgs call.
This pays off when the `*[sS]ystem` options are removed.
[without much trouble]: https://github.com/NixOS/nixpkgs/pull/237218