Merge pull request #209816 from Artturin/deprecate-top-level-platform-aliases

This commit is contained in:
Artturi 2023-01-09 22:15:50 +02:00 committed by GitHub
commit 27c1ec2ecf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 40 additions and 54 deletions

View file

@ -12,14 +12,14 @@ in {
type = types.package; type = types.package;
default = pkgs.steam.override { default = pkgs.steam.override {
extraLibraries = pkgs: with config.hardware.opengl; extraLibraries = pkgs: with config.hardware.opengl;
if pkgs.hostPlatform.is64bit if pkgs.stdenv.hostPlatform.is64bit
then [ package ] ++ extraPackages then [ package ] ++ extraPackages
else [ package32 ] ++ extraPackages32; else [ package32 ] ++ extraPackages32;
}; };
defaultText = literalExpression '' defaultText = literalExpression ''
pkgs.steam.override { pkgs.steam.override {
extraLibraries = pkgs: with config.hardware.opengl; extraLibraries = pkgs: with config.hardware.opengl;
if pkgs.hostPlatform.is64bit if pkgs.stdenv.hostPlatform.is64bit
then [ package ] ++ extraPackages then [ package ] ++ extraPackages
else [ package32 ] ++ extraPackages32; else [ package32 ] ++ extraPackages32;
} }

View file

@ -819,10 +819,10 @@ in
system-features = mkDefault ( system-features = mkDefault (
[ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++ [ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++
optionals (pkgs.hostPlatform ? gcc.arch) ( optionals (pkgs.stdenv.hostPlatform ? gcc.arch) (
# a builder can run code for `gcc.arch` and inferior architectures # a builder can run code for `gcc.arch` and inferior architectures
[ "gccarch-${pkgs.hostPlatform.gcc.arch}" ] ++ [ "gccarch-${pkgs.stdenv.hostPlatform.gcc.arch}" ] ++
map (x: "gccarch-${x}") (systems.architectures.inferiors.${pkgs.hostPlatform.gcc.arch} or []) map (x: "gccarch-${x}") (systems.architectures.inferiors.${pkgs.stdenv.hostPlatform.gcc.arch} or [])
) )
); );
} }

View file

@ -21,7 +21,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
}; };
testScript = let testScript = let
nixosInstallISO = (import ../release.nix {}).iso_minimal.${pkgs.hostPlatform.system}; nixosInstallISO = (import ../release.nix {}).iso_minimal.${pkgs.stdenv.hostPlatform.system};
virshShutdownCmd = if pkgs.stdenv.isx86_64 then "shutdown" else "destroy"; virshShutdownCmd = if pkgs.stdenv.isx86_64 then "shutdown" else "destroy";
in '' in ''
start_all() start_all()

View file

@ -1,5 +1,5 @@
{ autoreconfHook, boost180, cargo, coreutils, curl, cxx-rs, db62, fetchFromGitHub { autoreconfHook, boost180, cargo, coreutils, curl, cxx-rs, db62, fetchFromGitHub
, hexdump, hostPlatform, lib, libevent, libsodium, makeWrapper, rust, rustPlatform , hexdump, lib, libevent, libsodium, makeWrapper, rust, rustPlatform
, pkg-config, Security, stdenv, testers, utf8cpp, util-linux, zcash, zeromq , pkg-config, Security, stdenv, testers, utf8cpp, util-linux, zcash, zeromq
}: }:
@ -82,6 +82,6 @@ rustPlatform.buildRustPackage.override { inherit stdenv; } rec {
license = licenses.mit; license = licenses.mit;
# https://github.com/zcash/zcash/issues/4405 # https://github.com/zcash/zcash/issues/4405
broken = hostPlatform.isAarch64 && hostPlatform.isDarwin; broken = stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isDarwin;
}; };
} }

View file

@ -13,7 +13,7 @@
, alsa-lib, cairo, acl, gpm, m17n_lib, libotf , alsa-lib, cairo, acl, gpm, m17n_lib, libotf
, sigtool, jansson, harfbuzz, sqlite, nixosTests , sigtool, jansson, harfbuzz, sqlite, nixosTests
, recurseIntoAttrs, emacsPackagesFor , recurseIntoAttrs, emacsPackagesFor
, libgccjit, targetPlatform, makeWrapper # native-comp params , libgccjit, makeWrapper # native-comp params
, fetchFromSavannah, fetchFromBitbucket , fetchFromSavannah, fetchFromBitbucket
# macOS dependencies for NS and macPort # macOS dependencies for NS and macPort

View file

@ -1,5 +1,4 @@
{ buildPackages { buildPackages
, buildPlatform
, fetchzip , fetchzip
, javaOpts ? "-XX:+UseZGC" , javaOpts ? "-XX:+UseZGC"
, jdk , jdk
@ -23,7 +22,7 @@ stdenvNoCC.mkDerivation rec {
nativeBuildInputs = [ jdk makeWrapper ]; nativeBuildInputs = [ jdk makeWrapper ];
LANG = "en_US.UTF-8"; LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = lib.optionalString (buildPlatform.libc == "glibc") LOCALE_ARCHIVE = lib.optionalString (stdenvNoCC.buildPlatform.libc == "glibc")
"${buildPackages.glibcLocales}/lib/locale/locale-archive"; "${buildPackages.glibcLocales}/lib/locale/locale-archive";
buildPhase = '' buildPhase = ''

View file

@ -4,7 +4,6 @@
, alex , alex
, happy , happy
, Agda , Agda
, buildPlatform
, buildPackages , buildPackages
, ghcWithPackages , ghcWithPackages
}: }:
@ -30,7 +29,7 @@ stdenv.mkDerivation rec {
LANG = "en_US.UTF-8"; LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = LOCALE_ARCHIVE =
lib.optionalString (buildPlatform.libc == "glibc") lib.optionalString (stdenv.buildPlatform.libc == "glibc")
"${buildPackages.glibcLocales}/lib/locale/locale-archive"; "${buildPackages.glibcLocales}/lib/locale/locale-archive";
postPatch = '' postPatch = ''

View file

@ -3,7 +3,6 @@
, cacert , cacert
, curl , curl
, runCommandLocal , runCommandLocal
, targetPlatform
, unzip , unzip
, appimage-run , appimage-run
, addOpenGLRunpath , addOpenGLRunpath
@ -49,7 +48,7 @@ let
SITEURL = "https://www.blackmagicdesign.com/api/register/us/download/${DOWNLOADID}"; SITEURL = "https://www.blackmagicdesign.com/api/register/us/download/${DOWNLOADID}";
USERAGENT = builtins.concatStringsSep " " [ USERAGENT = builtins.concatStringsSep " " [
"User-Agent: Mozilla/5.0 (X11; Linux ${targetPlatform.linuxArch})" "User-Agent: Mozilla/5.0 (X11; Linux ${stdenv.targetPlatform.linuxArch})"
"AppleWebKit/537.36 (KHTML, like Gecko)" "AppleWebKit/537.36 (KHTML, like Gecko)"
"Chrome/77.0.3865.75" "Chrome/77.0.3865.75"
"Safari/537.36" "Safari/537.36"

View file

@ -1,7 +1,7 @@
{ lib { lib
, stdenv
, callPackage , callPackage
, buildPackages , buildPackages
, hostPlatform
}: }:
let let
@ -34,9 +34,9 @@ let
}; };
in in
( (
if hostPlatform.system == "aarch64-darwin" then aarch64-dmg if stdenv.hostPlatform.system == "aarch64-darwin" then aarch64-dmg
else if hostPlatform.isDarwin then x86_64-dmg else if stdenv.hostPlatform.isDarwin then x86_64-dmg
else if hostPlatform.isCygwin then x86_64-windows else if stdenv.hostPlatform.isCygwin then x86_64-windows
else x86_64-appimage else x86_64-appimage
).overrideAttrs ).overrideAttrs
(oldAttrs: { (oldAttrs: {

View file

@ -26,7 +26,6 @@
, git , git
, dart , dart
, nukeReferences , nukeReferences
, targetPlatform
, bash , bash
, curl , curl
, unzip , unzip
@ -57,7 +56,7 @@ let
self = self =
(self: llvmPackages_13.stdenv.mkDerivation (args // { (self: llvmPackages_13.stdenv.mkDerivation (args // {
deps = stdenvNoCC.mkDerivation (lib.recursiveUpdate (getAttrsOrNull fetchAttrs args) { deps = stdenvNoCC.mkDerivation (lib.recursiveUpdate (getAttrsOrNull fetchAttrs args) {
name = "${self.name}-deps-flutter-v${flutter.unwrapped.version}-${targetPlatform.system}.tar.gz"; name = "${self.name}-deps-flutter-v${flutter.unwrapped.version}-${stdenvNoCC.targetPlatform.system}.tar.gz";
nativeBuildInputs = flutterDeps ++ [ nativeBuildInputs = flutterDeps ++ [
nukeReferences nukeReferences

View file

@ -1,6 +1,6 @@
{ lib, buildPlatform, buildRustCrate, fetchgit }: { lib, stdenv, buildRustCrate, fetchgit }:
let kernel = buildPlatform.parsed.kernel.name; let kernel = stdenv.buildPlatform.parsed.kernel.name;
abi = buildPlatform.parsed.abi.name; abi = stdenv.buildPlatform.parsed.abi.name;
include = includedFiles: src: builtins.filterSource (path: type: include = includedFiles: src: builtins.filterSource (path: type:
lib.lists.any (f: lib.lists.any (f:
let p = toString (src + ("/" + f)); in let p = toString (src + ("/" + f)); in

View file

@ -448,7 +448,7 @@ self: super: {
# #
# # Depends on itself for testing # # Depends on itself for testing
# doctest-discover = addBuildTool super.doctest-discover # doctest-discover = addBuildTool super.doctest-discover
# (if pkgs.buildPlatform != pkgs.hostPlatform # (if pkgs.stdenv.buildPlatform != pkgs.stdenv.hostPlatform
# then self.buildHaskellPackages.doctest-discover # then self.buildHaskellPackages.doctest-discover
# else dontCheck super.doctest-discover); # else dontCheck super.doctest-discover);
doctest-discover = dontCheck super.doctest-discover; doctest-discover = dontCheck super.doctest-discover;

View file

@ -6,7 +6,6 @@
, fetchpatch , fetchpatch
, fetchurl , fetchurl
, flatbuffers , flatbuffers
, hostPlatform
, lib , lib
, zlib , zlib
}: }:
@ -160,7 +159,7 @@ stdenv.mkDerivation rec {
mkdir "$out" mkdir "$out"
# copy the static lib and binaries into the output dir # copy the static lib and binaries into the output dir
cp -r ./tensorflow/lite/tools/make/gen/linux_${hostPlatform.uname.processor}/{bin,lib} "$out" cp -r ./tensorflow/lite/tools/make/gen/linux_${stdenv.hostPlatform.uname.processor}/{bin,lib} "$out"
find ./tensorflow/lite -type f -name '*.h' | while read f; do find ./tensorflow/lite -type f -name '*.h' | while read f; do
path="$out/include/''${f/.\//}" path="$out/include/''${f/.\//}"

View file

@ -1,4 +1,5 @@
{ lib { lib
, stdenv
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, future , future
@ -6,7 +7,6 @@
, numpy , numpy
, pyserial , pyserial
, pyusb , pyusb
, hostPlatform
, pytestCheckHook , pytestCheckHook
, pythonOlder , pythonOlder
}: }:
@ -33,7 +33,7 @@ buildPythonPackage rec {
pyusb pyusb
]; ];
postInstall = lib.optionalString hostPlatform.isLinux '' postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
mkdir -p $out/etc/udev/rules.d mkdir -p $out/etc/udev/rules.d
cp etc/udev/rules.d/20-rfcat.rules $out/etc/udev/rules.d cp etc/udev/rules.d/20-rfcat.rules $out/etc/udev/rules.d
''; '';

View file

@ -1,7 +1,7 @@
{ {
lib, lib,
dotnet-sdk, dotnet-sdk,
targetPlatform, stdenv,
substituteAll, substituteAll,
buildDotnetModule, buildDotnetModule,
@ -34,7 +34,7 @@ buildDotnetModule rec {
patches = [ patches = [
(substituteAll { (substituteAll {
src = ./add-runtime-identifier.patch; src = ./add-runtime-identifier.patch;
runtimeIdentifier = dotnetCorePackages.systemToDotnetRid targetPlatform.system; runtimeIdentifier = dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system;
}) })
]; ];

View file

@ -1,6 +1,5 @@
{ lib { lib
, pkgs , pkgs
, hostPlatform
, stdenvNoCC , stdenvNoCC
, fetchFromGitHub , fetchFromGitHub
, pkgsCross , pkgsCross
@ -8,7 +7,7 @@
stdenvNoCC.mkDerivation (finalAttrs: stdenvNoCC.mkDerivation (finalAttrs:
let let
inherit (hostPlatform.uname) system; inherit (stdenvNoCC.hostPlatform.uname) system;
# DXVK needs to be a separate derivation because its actually a set of DLLs for Windows that # DXVK needs to be a separate derivation because its actually a set of DLLs for Windows that
# needs to be built with a cross-compiler. # needs to be built with a cross-compiler.
dxvk32 = pkgsCross.mingw32.callPackage ./dxvk.nix { dxvk32 = pkgsCross.mingw32.callPackage ./dxvk.nix {

View file

@ -1,10 +1,10 @@
{ buildPlatform, requireFile, targetPlatform, lib }: { stdenv, requireFile, lib }:
let requireXcode = version: sha256: let requireXcode = version: sha256:
let let
xip = "Xcode_" + version + ".xip"; xip = "Xcode_" + version + ".xip";
# TODO(alexfmpe): Find out how to validate the .xip signature in Linux # TODO(alexfmpe): Find out how to validate the .xip signature in Linux
unxip = if buildPlatform.isDarwin unxip = if stdenv.buildPlatform.isDarwin
then '' then ''
open -W ${xip} open -W ${xip}
rm -rf ${xip} rm -rf ${xip}
@ -66,6 +66,6 @@ in lib.makeExtensible (self: {
xcode_12_1 = requireXcode "12.1" "1widy74dk43wx8iqgd7arzf6q4kzdmaz8pfwymzs8chnq9dqr3wp"; xcode_12_1 = requireXcode "12.1" "1widy74dk43wx8iqgd7arzf6q4kzdmaz8pfwymzs8chnq9dqr3wp";
xcode_12_2 = requireXcode "12.2" "17i0wf4pwrxwfgjw7rpw9mcd59nkmys1k5h2rqsw81snzyxy9j0v"; xcode_12_2 = requireXcode "12.2" "17i0wf4pwrxwfgjw7rpw9mcd59nkmys1k5h2rqsw81snzyxy9j0v";
xcode_12_3 = requireXcode "12.3" "0kwf1y4llysf1p0nsbqyzccn7d77my0ldagr5fi3by4k0xy3d189"; xcode_12_3 = requireXcode "12.3" "0kwf1y4llysf1p0nsbqyzccn7d77my0ldagr5fi3by4k0xy3d189";
xcode = self."xcode_${lib.replaceStrings ["."] ["_"] (if (targetPlatform ? xcodeVer) then targetPlatform.xcodeVer else "12.3")}"; xcode = self."xcode_${lib.replaceStrings ["."] ["_"] (if (stdenv.targetPlatform ? xcodeVer) then stdenv.targetPlatform.xcodeVer else "12.3")}";
}) })

View file

@ -1,4 +1,4 @@
{ targetPlatform { stdenv
, clang-unwrapped , clang-unwrapped
, binutils-unwrapped , binutils-unwrapped
, runCommand , runCommand
@ -12,7 +12,7 @@
let let
minSdkVersion = targetPlatform.minSdkVersion or "9.0"; minSdkVersion = stdenv.targetPlatform.minSdkVersion or "9.0";
in in
@ -22,8 +22,8 @@ rec {
type = "derivation"; type = "derivation";
outPath = xcode + "/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}${version}.sdk"; outPath = xcode + "/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}${version}.sdk";
platform = targetPlatform.xcodePlatform; platform = stdenv.targetPlatform.xcodePlatform;
version = targetPlatform.sdkVer; version = stdenv.targetPlatform.sdkVer;
}; };
binutils = wrapBintoolsWith { binutils = wrapBintoolsWith {
@ -39,7 +39,7 @@ rec {
extraBuildCommands = '' extraBuildCommands = ''
tr '\n' ' ' < $out/nix-support/cc-cflags > cc-cflags.tmp tr '\n' ' ' < $out/nix-support/cc-cflags > cc-cflags.tmp
mv cc-cflags.tmp $out/nix-support/cc-cflags mv cc-cflags.tmp $out/nix-support/cc-cflags
echo "-target ${targetPlatform.config}" >> $out/nix-support/cc-cflags echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags
echo "-isystem ${sdk}/usr/include${lib.optionalString (lib.versionAtLeast "10" sdk.version) " -isystem ${sdk}/usr/include/c++/4.2.1/ -stdlib=libstdc++"}" >> $out/nix-support/cc-cflags echo "-isystem ${sdk}/usr/include${lib.optionalString (lib.versionAtLeast "10" sdk.version) " -isystem ${sdk}/usr/include/c++/4.2.1/ -stdlib=libstdc++"}" >> $out/nix-support/cc-cflags
${lib.optionalString (lib.versionAtLeast sdk.version "14") "echo -isystem ${xcode}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 >> $out/nix-support/cc-cflags"} ${lib.optionalString (lib.versionAtLeast sdk.version "14") "echo -isystem ${xcode}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 >> $out/nix-support/cc-cflags"}
''; '';

View file

@ -8,7 +8,7 @@ let
) lib.systems.examples; ) lib.systems.examples;
getExecutable = pkgs: pkgFun: exec: getExecutable = pkgs: pkgFun: exec:
"${pkgFun pkgs}${exec}${pkgs.hostPlatform.extensions.executable}"; "${pkgFun pkgs}${exec}${pkgs.stdenv.hostPlatform.extensions.executable}";
compareTest = { emulator, pkgFun, hostPkgs, crossPkgs, exec, args ? [] }: let compareTest = { emulator, pkgFun, hostPkgs, crossPkgs, exec, args ? [] }: let
pkgName = (pkgFun hostPkgs).name; pkgName = (pkgFun hostPkgs).name;
@ -55,7 +55,7 @@ let
mapMultiPlatformTest = crossSystemFun: test: lib.mapAttrs (name: system: test rec { mapMultiPlatformTest = crossSystemFun: test: lib.mapAttrs (name: system: test rec {
crossPkgs = import pkgs.path { crossPkgs = import pkgs.path {
localSystem = { inherit (pkgs.hostPlatform) config; }; localSystem = { inherit (pkgs.stdenv.hostPlatform) config; };
crossSystem = crossSystemFun system; crossSystem = crossSystemFun system;
}; };

View file

@ -1,7 +1,7 @@
{ cmake, cudatoolkit, fetchFromGitHub, gfortran, lib, llvmPackages, python3Packages, stdenv, targetPlatform { cmake, cudatoolkit, fetchFromGitHub, gfortran, lib, llvmPackages, python3Packages, stdenv
, enableCfp ? true , enableCfp ? true
, enableCuda ? false , enableCuda ? false
, enableFortran ? builtins.elem targetPlatform.system gfortran.meta.platforms , enableFortran ? builtins.elem stdenv.targetPlatform.system gfortran.meta.platforms
, enableOpenMP ? true , enableOpenMP ? true
, enablePython ? true , enablePython ? true
, enableUtilities ? true }: , enableUtilities ? true }:

View file

@ -1773,6 +1773,7 @@ mapAliases ({
zyn-fusion = zynaddsubfx; # Added 2022-08-05 zyn-fusion = zynaddsubfx; # Added 2022-08-05
inherit (stdenv.hostPlatform) system; # Added 2021-10-22 inherit (stdenv.hostPlatform) system; # Added 2021-10-22
inherit (stdenv) buildPlatform hostPlatform targetPlatform; # Added 2023-01-09
# LLVM packages for (integration) testing that should not be used inside Nixpkgs: # LLVM packages for (integration) testing that should not be used inside Nixpkgs:
llvmPackages_git = recurseIntoAttrs (callPackage ../development/compilers/llvm/git { llvmPackages_git = recurseIntoAttrs (callPackage ../development/compilers/llvm/git {

View file

@ -138,14 +138,6 @@ let
inherit stdenv; inherit stdenv;
}; };
# 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;
};
splice = self: super: import ./splice.nix lib self (adjacentPackages != null); splice = self: super: import ./splice.nix lib self (adjacentPackages != null);
allPackages = self: super: allPackages = self: super:
@ -282,7 +274,6 @@ let
# previous bootstrapping phases which have already been overlayed. # previous bootstrapping phases which have already been overlayed.
toFix = lib.foldl' (lib.flip lib.extends) (self: {}) ([ toFix = lib.foldl' (lib.flip lib.extends) (self: {}) ([
stdenvBootstappingAndPlatforms stdenvBootstappingAndPlatforms
platformCompat
stdenvAdapters stdenvAdapters
trivialBuilders trivialBuilders
splice splice