summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <mail@JohnEricson.me>2018-09-06 07:52:17 -0400
committerGitHub <noreply@github.com>2018-09-06 07:52:17 -0400
commit0af9072e74c9e70af62e828ba4fb21391df2e601 (patch)
tree23ee36fca889282eb6feebfa466a5e7b9cda11b3
parent7c1b85cf6de1dc431e5736bff8adf01224e6abe5 (diff)
parente51f736076548459f36a1250de4bf6867f880b66 (diff)
downloadnixlib-0af9072e74c9e70af62e828ba4fb21391df2e601.tar
nixlib-0af9072e74c9e70af62e828ba4fb21391df2e601.tar.gz
nixlib-0af9072e74c9e70af62e828ba4fb21391df2e601.tar.bz2
nixlib-0af9072e74c9e70af62e828ba4fb21391df2e601.tar.lz
nixlib-0af9072e74c9e70af62e828ba4fb21391df2e601.tar.xz
nixlib-0af9072e74c9e70af62e828ba4fb21391df2e601.tar.zst
nixlib-0af9072e74c9e70af62e828ba4fb21391df2e601.zip
Merge pull request #46059 from obsidiansystems/deprecate-top-level-platform-aliases
top-level: Deprecate top-level `{build,host,target}Platform`
-rw-r--r--doc/cross-compilation.xml10
-rw-r--r--pkgs/top-level/stage.nix16
2 files changed, 14 insertions, 12 deletions
diff --git a/doc/cross-compilation.xml b/doc/cross-compilation.xml
index 3b90596bcc2c..c7187d86d1b3 100644
--- a/doc/cross-compilation.xml
+++ b/doc/cross-compilation.xml
@@ -47,13 +47,9 @@
 
    <para>
     In Nixpkgs, these three platforms are defined as attribute sets under the
-    names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>,
-    and <literal>targetPlatform</literal>. 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 <literal>callPackage</literal>:
-<programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...buildPlatform...</programlisting>
-    , or just off <varname>stdenv</varname>:
+    names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and
+    <literal>targetPlatform</literal>. They are always defined as attributes in
+    the standard environment. That means one can access them like:
 <programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting>
     .
    </para>
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index 06978d1067bf..5ca8b72b8b8e 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -79,11 +79,17 @@ let
 
   # The old identifiers for cross-compiling. These should eventually be removed,
   # and the packages that rely on them refactored accordingly.
-  platformCompat = self: super: let
-    inherit (super.stdenv) buildPlatform hostPlatform targetPlatform;
-  in {
-    inherit buildPlatform hostPlatform targetPlatform;
-    inherit (buildPlatform) system;
+  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.buildPlatform) system;
   };
 
   splice = self: super: import ./splice.nix lib self (buildPackages != null);