From 2a6e4ae49a891adc7c0562fda08b17d60beb1b4f Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Tue, 11 Sep 2018 12:04:00 +0200 Subject: [PATCH] Revert "top-level: Deprecate top-level `{build,host,target}Platform`" This reverts commit e51f736076548459f36a1250de4bf6867f880b66. --- doc/cross-compilation.xml | 10 +++++++--- pkgs/top-level/stage.nix | 16 +++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/doc/cross-compilation.xml b/doc/cross-compilation.xml index c7187d86d1b3..3b90596bcc2c 100644 --- a/doc/cross-compilation.xml +++ b/doc/cross-compilation.xml @@ -47,9 +47,13 @@ In Nixpkgs, these three platforms are defined as attribute sets under the - names buildPlatform, hostPlatform, and - targetPlatform. They are always defined as attributes in - the standard environment. That means one can access them like: + names buildPlatform, hostPlatform, + and targetPlatform. All three are always defined as + attributes in the standard environment, and at the top level. That means + one can get at them just like a dependency in a function that is imported + with callPackage: +{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...buildPlatform... + , or just off stdenv: { stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform... . diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index ff09fa5ad1fd..06978d1067bf 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -79,17 +79,11 @@ let # The old identifiers for cross-compiling. These should eventually be removed, # and the packages that rely on them refactored accordingly. - platformCompat = self: super: { - buildPlatform = lib.warn - "top-level `buildPlatform` is deprecated since 18.09. Please use `stdenv.buildPlatform`." - super.stdenv.buildPlatform; - hostPlatform = lib.warn - "top-level `hostPlatform` is deprecated since 18.09. Please use `stdenv.hostPlatform`." - super.stdenv.hostPlatform; - targetPlatform = lib.warn - "top-level `targetPlatform` is deprecated since 18.09. Please use `stdenv.targetPlatform`." - super.stdenv.targetPlatform; - inherit (super.stdenv.hostPlatform) system; + platformCompat = self: super: let + inherit (super.stdenv) buildPlatform hostPlatform targetPlatform; + in { + inherit buildPlatform hostPlatform targetPlatform; + inherit (buildPlatform) system; }; splice = self: super: import ./splice.nix lib self (buildPackages != null);