Skip to content

Commit 2a6e4ae

Browse files
committed
Revert "top-level: Deprecate top-level {build,host,target}Platform"
This reverts commit e51f736.
1 parent e02575b commit 2a6e4ae

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

doc/cross-compilation.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@
4747

4848
<para>
4949
In Nixpkgs, these three platforms are defined as attribute sets under the
50-
names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and
51-
<literal>targetPlatform</literal>. They are always defined as attributes in
52-
the standard environment. That means one can access them like:
50+
names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>,
51+
and <literal>targetPlatform</literal>. All three are always defined as
52+
attributes in the standard environment, and at the top level. That means
53+
one can get at them just like a dependency in a function that is imported
54+
with <literal>callPackage</literal>:
55+
<programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...buildPlatform...</programlisting>
56+
, or just off <varname>stdenv</varname>:
5357
<programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting>
5458
.
5559
</para>

pkgs/top-level/stage.nix

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,11 @@ let
7979

8080
# The old identifiers for cross-compiling. These should eventually be removed,
8181
# and the packages that rely on them refactored accordingly.
82-
platformCompat = self: super: {
83-
buildPlatform = lib.warn
84-
"top-level `buildPlatform` is deprecated since 18.09. Please use `stdenv.buildPlatform`."
85-
super.stdenv.buildPlatform;
86-
hostPlatform = lib.warn
87-
"top-level `hostPlatform` is deprecated since 18.09. Please use `stdenv.hostPlatform`."
88-
super.stdenv.hostPlatform;
89-
targetPlatform = lib.warn
90-
"top-level `targetPlatform` is deprecated since 18.09. Please use `stdenv.targetPlatform`."
91-
super.stdenv.targetPlatform;
92-
inherit (super.stdenv.hostPlatform) system;
82+
platformCompat = self: super: let
83+
inherit (super.stdenv) buildPlatform hostPlatform targetPlatform;
84+
in {
85+
inherit buildPlatform hostPlatform targetPlatform;
86+
inherit (buildPlatform) system;
9387
};
9488

9589
splice = self: super: import ./splice.nix lib self (buildPackages != null);

0 commit comments

Comments
 (0)