From 773233ca771a359e63328a57216f57fd45092e60 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 27 Aug 2018 14:39:58 -0400 Subject: [PATCH 1/2] top-level, stdenv: Make `system` and `stdenv.system` describe the hostPlatform. Intuitively, one cares mainly about the host platform: Platforms differ in meaningful ways but compilation is morally a pure process and probably doesn't care, or those difference are already abstracted away. @Dezgeg also empirically confirmed that > 95% of checks are indeed of the host platform. Yet these attributes in the old cross infrastructure were defined to be the build platform, for expediency. And this was never before changed. (For native builds build and host coincide, so it isn't clear what the intention was.) Fixing this doesn't affect native builds, since again they coincide. It also doesn't affect cross builds of anything in Nixpkgs, as these are no longer used. It could affect external cross builds, but I deem that unlikely as anyone thinking about cross would use more explicit attributes for clarity, all the more so because the rarity of inspecting the build platform. --- pkgs/stdenv/generic/default.nix | 3 +++ pkgs/top-level/stage.nix | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index ac727034b8e7..be9d38f9780a 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -127,6 +127,9 @@ let "`stdenv.isArm` is deprecated after 18.03. Please use `stdenv.isAarch32` instead" hostPlatform.isAarch32; + # The derivation's `system` is `buildPlatform.system`. + inherit (buildPlatform) system; + # Whether we should run paxctl to pax-mark binaries. needsPax = isLinux; diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 5ca8b72b8b8e..ff09fa5ad1fd 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -89,7 +89,7 @@ let targetPlatform = lib.warn "top-level `targetPlatform` is deprecated since 18.09. Please use `stdenv.targetPlatform`." super.stdenv.targetPlatform; - inherit (super.stdenv.buildPlatform) system; + inherit (super.stdenv.hostPlatform) system; }; splice = self: super: import ./splice.nix lib self (buildPackages != null); From 8ae27030aa4989d42f9335d4b80a5a4d3d6d039c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 27 Aug 2018 14:39:58 -0400 Subject: [PATCH 2/2] doc: Add changelog entry for new definition of `system` and `stdenv.system` See the previous commit for details. --- nixos/doc/manual/release-notes/rl-1809.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-1809.xml b/nixos/doc/manual/release-notes/rl-1809.xml index 421208ec0f8c..be225f18c24e 100644 --- a/nixos/doc/manual/release-notes/rl-1809.xml +++ b/nixos/doc/manual/release-notes/rl-1809.xml @@ -283,6 +283,14 @@ $ nix-instantiate -E '(import <nixpkgsunstable> {}).gitFull' from your config without any issues. + + + stdenv.system and system in nixpkgs now refer to the host platform instead of the build platform. + For native builds this is not change, let alone a breaking one. + For cross builds, it is a breaking change, and stdenv.buildPlatform.system can be used instead for the old behavior. + They should be using that anyways for clarity. + +