Merge pull request #46059 from obsidiansystems/deprecate-top-level-platform-aliases

top-level: Deprecate top-level `{build,host,target}Platform`
This commit is contained in:
John Ericson 2018-09-06 07:52:17 -04:00 committed by GitHub
commit 0af9072e74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 12 deletions

View File

@ -47,13 +47,9 @@
<para> <para>
In Nixpkgs, these three platforms are defined as attribute sets under the In Nixpkgs, these three platforms are defined as attribute sets under the
names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and
and <literal>targetPlatform</literal>. All three are always defined as <literal>targetPlatform</literal>. They are always defined as attributes in
attributes in the standard environment, and at the top level. That means the standard environment. That means one can access them like:
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>:
<programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting> <programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting>
. .
</para> </para>

View File

@ -79,11 +79,17 @@ let
# The old identifiers for cross-compiling. These should eventually be removed, # The old identifiers for cross-compiling. These should eventually be removed,
# and the packages that rely on them refactored accordingly. # and the packages that rely on them refactored accordingly.
platformCompat = self: super: let platformCompat = self: super: {
inherit (super.stdenv) buildPlatform hostPlatform targetPlatform; buildPlatform = lib.warn
in { "top-level `buildPlatform` is deprecated since 18.09. Please use `stdenv.buildPlatform`."
inherit buildPlatform hostPlatform targetPlatform; super.stdenv.buildPlatform;
inherit (buildPlatform) system; 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); splice = self: super: import ./splice.nix lib self (buildPackages != null);