treewide: use isAarch where appropriate

This commit is contained in:
Alyssa Ross 2022-07-30 16:18:27 +00:00
parent 64915e05bf
commit 5330c0a1af
No known key found for this signature in database
GPG Key ID: F9DBED4859B271C0
24 changed files with 30 additions and 32 deletions

View File

@ -18,7 +18,7 @@ rec {
];
qemuSerialDevice = if pkgs.stdenv.hostPlatform.isx86 || pkgs.stdenv.hostPlatform.isRiscV then "ttyS0"
else if (with pkgs.stdenv.hostPlatform; isAarch32 || isAarch64 || isPower) then "ttyAMA0"
else if (with pkgs.stdenv.hostPlatform; isAarch || isPower) then "ttyAMA0"
else throw "Unknown QEMU serial device for system '${pkgs.stdenv.hostPlatform.system}'";
qemuBinary = qemuPkg: {

View File

@ -62,7 +62,7 @@ in {
alsa-firmware
sof-firmware
libreelec-dvb-firmware
] ++ optional (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) raspberrypiWirelessFirmware
] ++ optional pkgs.stdenv.hostPlatform.isAarch raspberrypiWirelessFirmware
++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [
rtl8723bs-firmware
] ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "5.16") [

View File

@ -478,7 +478,7 @@ in
default = with pkgs.stdenv.targetPlatform; "xz -Xdict-size 100% "
+ lib.optionalString (isx86_32 || isx86_64) "-Xbcj x86"
# Untested but should also reduce size for these platforms
+ lib.optionalString (isAarch32 || isAarch64) "-Xbcj arm"
+ lib.optionalString isAarch "-Xbcj arm"
+ lib.optionalString (isPower && is32bit && isBigEndian) "-Xbcj powerpc"
+ lib.optionalString (isSparc) "-Xbcj sparc";
description = ''

View File

@ -57,7 +57,7 @@ in
# Hyper-V support.
"hv_storvsc"
] ++ lib.optionals (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [
] ++ lib.optionals pkgs.stdenv.hostPlatform.isAarch [
# Most of the following falls into two categories:
# - early KMS / early display
# - early storage (e.g. USB) support

View File

@ -92,7 +92,7 @@ in {
"default_config"
"met"
"esphome"
] ++ optionals (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) [
] ++ optionals pkgs.stdenv.hostPlatform.isAarch [
# Use the platform as an indicator that we might be running on a RaspberryPi and include
# relevant components
"rpi_power"

View File

@ -870,7 +870,7 @@ in
(mkIf pkgs.stdenv.hostPlatform.isx86 [
"-usb" "-device usb-tablet,bus=usb-bus.0"
])
(mkIf (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [
(mkIf pkgs.stdenv.hostPlatform.isAarch [
"-device virtio-gpu-pci" "-device usb-ehci,id=usb0" "-device usb-kbd" "-device usb-tablet"
])
(let

View File

@ -80,7 +80,6 @@
let
inherit (lib) optionalString optional optionals;
hostIsAarch = stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64;
in
stdenv.mkDerivation rec {
pname = "${optionalString onlyLibVLC "lib"}vlc";
@ -159,7 +158,7 @@ stdenv.mkDerivation rec {
xcbutilkeysyms
xlibsWrapper
])
++ optional (!hostIsAarch && !onlyLibVLC) live555
++ optional (!stdenv.hostPlatform.isAarch && !onlyLibVLC) live555
++ optional jackSupport libjack2
++ optionals chromecastSupport [ libmicrodns protobuf ]
++ optionals skins2Support (with xorg; [
@ -184,7 +183,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
LIVE555_PREFIX = if hostIsAarch then null else live555;
LIVE555_PREFIX = if stdenv.hostPlatform.isAarch then null else live555;
# vlc depends on a c11-gcc wrapper script which we don't have so we need to
# set the path to the compiler

View File

@ -1,8 +1,8 @@
# ARM-SPECIFIC OVERRIDES FOR THE HASKELL PACKAGE SET IN NIXPKGS
#
# This extension is applied to all haskell package sets in nixpkgs
# if `stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64`
# to apply arm specific workarounds or fixes.
# This extension is applied to all haskell package sets in nixpkgs if
# `stdenv.hostPlatform.isAarch` to apply arm specific workarounds or
# fixes.
#
# The file is split into three parts:
#

View File

@ -21,8 +21,7 @@ let
inherit stdenv haskellLib ghc buildHaskellPackages extensible-self all-cabal-hashes;
};
isArm = with stdenv.hostPlatform; isAarch64 || isAarch32;
platformConfigurations = lib.optionals isArm [
platformConfigurations = lib.optionals stdenv.hostPlatform.isAarch [
(configurationArm { inherit pkgs haskellLib; })
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
(configurationDarwin { inherit pkgs haskellLib; })

View File

@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
# emulating build_all.sh configuration variables
jplatform =
if stdenv.isDarwin then "darwin"
else if (stdenv.isAarch32 || stdenv.isAarch64) then "raspberry"
else if stdenv.hostPlatform.isAarch then "raspberry"
else if stdenv.isLinux then "linux"
else "unsupported";

View File

@ -69,7 +69,7 @@ stdenv.mkDerivation rec {
patchShebangs ../test/
mkdir ../test/tmp
${lib.optionalString (stdenv.isAarch64 || stdenv.isAarch32) ''
${lib.optionalString stdenv.hostPlatform.isAarch ''
# Fix tests on arm
# https://github.com/Exiv2/exiv2/issues/933
rm -f ../tests/bugfixes/github/test_CVE_2018_12265.py

View File

@ -29,11 +29,11 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ autoreconfHook ];
# tcmalloc uses libunwind in a way that works correctly only on non-ARM linux
buildInputs = lib.optional (stdenv.isLinux && !(stdenv.isAarch64 || stdenv.isAarch32)) libunwind;
buildInputs = lib.optional (stdenv.isLinux && !stdenv.hostPlatform.isAarch) libunwind;
# Disable general dynamic TLS on AArch to support dlopen()'ing the library:
# https://bugzilla.redhat.com/show_bug.cgi?id=1483558
configureFlags = lib.optional (stdenv.isAarch32 || stdenv.isAarch64)
configureFlags = lib.optional stdenv.hostPlatform.isAarch
"--disable-general-dynamic-tls";
prePatch = lib.optionalString stdenv.isDarwin ''

View File

@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
"-Dnm-path=${stdenv.cc.targetPrefix}nm"
"-Dinstall-test-programs=true"
"-Domap=true"
] ++ lib.optionals (stdenv.isAarch32 || stdenv.isAarch64) [
] ++ lib.optionals stdenv.hostPlatform.isAarch [
"-Dtegra=true"
"-Detnaviv=true"
];

View File

@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
preConfigure = lib.optionalString (stdenv.buildPlatform.isx86_64 || stdenv.hostPlatform.isi686) ''
# `AS' is set to the binutils assembler, but we need nasm
unset AS
'' + lib.optionalString (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) ''
'' + lib.optionalString stdenv.hostPlatform.isAarch ''
export AS=$CC
'';

View File

@ -85,7 +85,7 @@ buildPythonPackage rec {
"test_filename_without_dir"
"test_overwrite"
"test_options"
] ++ lib.optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV) [
] ++ lib.optionals (stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isRiscV) [
# unknown reason so far
# https://github.com/adobe-type-tools/afdko/issues/1425
"test_spec"

View File

@ -29,7 +29,7 @@ buildPythonPackage rec {
# Tests fail due to numeric precision differences on ARM
# See https://github.com/SethMMorton/fastnumbers/issues/28
doCheck = !(stdenv.isAarch64 || stdenv.isAarch32);
doCheck = !stdenv.hostPlatform.isAarch;
checkInputs = [
hypothesis

View File

@ -48,7 +48,7 @@ buildPythonPackage rec {
# Depend on pyopenssl
"--deselect tests/test_tcp.py::Test_UV_TCPSSL::test_flush_before_shutdown"
"--deselect tests/test_tcp.py::Test_UV_TCPSSL::test_renegotiation"
] ++ lib.optionals (stdenv.isAarch32 || stdenv.isAarch64) [
] ++ lib.optionals stdenv.hostPlatform.isAarch [
# test gets stuck in epoll_pwait on hydras aarch64 builders
# https://github.com/MagicStack/uvloop/issues/412
"--deselect tests/test_tcp.py::Test_AIO_TCPSSL::test_remote_shutdown_receives_trailing_data"

View File

@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
];
# "marbling" has NEON code that mixes signed and unsigned vector types
NIX_CFLAGS_COMPILE = lib.optional (with stdenv.hostPlatform; isAarch64 || isAarch32) "-flax-vector-conversions";
NIX_CFLAGS_COMPILE = lib.optional stdenv.hostPlatform.isAarch "-flax-vector-conversions";
postInstall = ''
for bin in $out/bin/*; do

View File

@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
buildPhase = "${stdenv.cc.targetPrefix}cc -o nmon ${src} -g -O2 -D JFS -D GETUSER -Wall -D LARGEMEM -lncurses -lm -g -D ${
with stdenv.targetPlatform;
if isx86_32 || isx86_64 then "X86"
else if isAarch32 || isAarch64 then "ARM"
else if isAarch then "ARM"
else if isPower then "POWER"
else "UNKNOWN"
}";

View File

@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
makeFlags = kernel.makeFlags ++ [
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
("CONFIG_PLATFORM_I386_PC=" + (if (stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if stdenv.hostPlatform.isAarch then "y" else "n"))
];
preInstall = ''

View File

@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
"ARCH=${stdenv.hostPlatform.linuxArch}"
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
("CONFIG_PLATFORM_I386_PC=" + (if stdenv.hostPlatform.isx86 then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if stdenv.hostPlatform.isAarch then "y" else "n"))
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
];

View File

@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
# - ignore test_screen because it assumes vt terminals exist
checkPhase = ''
pytest . \
${lib.optionalString (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) "--ignore=test/t/test_gcc.py"} \
${lib.optionalString stdenv.hostPlatform.isAarch "--ignore=test/t/test_gcc.py"} \
--ignore=test/t/test_chsh.py \
--ignore=test/t/test_ether_wake.py \
--ignore=test/t/test_ifdown.py \

View File

@ -178,7 +178,7 @@ let
# Except when:
# - static aarch64, where compilation works, but produces segfaulting dynamically linked binaries.
# - static armv7l, where compilation fails.
!((stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) && stdenv.hostPlatform.isStatic)
!(stdenv.hostPlatform.isAarch && stdenv.hostPlatform.isStatic)
then supportedHardeningFlags
else lib.remove "pie" supportedHardeningFlags;
enabledHardeningOptions =

View File

@ -108,7 +108,7 @@ in {
# aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar
# the oldest ghc with aarch64-darwin support is 8.10.5
# Musl bindists do not exist for ghc 8.6.5, so we use 8.10.* for them
if stdenv.isAarch64 || stdenv.isAarch32 then
if stdenv.hostPlatform.isAarch then
packages.ghc8107BinaryMinimal
else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
# to my (@a-m-joseph) knowledge there are no newer official binaries for this platform
@ -127,7 +127,7 @@ in {
bootPkgs =
# aarch64 ghc8107Binary exceeds max output size on hydra
# the oldest ghc with aarch64-darwin support is 8.10.5
if stdenv.isAarch64 || stdenv.isAarch32 then
if stdenv.hostPlatform.isAarch then
packages.ghc8107BinaryMinimal
else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
packages.ghc8107
@ -141,7 +141,7 @@ in {
ghc923 = callPackage ../development/compilers/ghc/9.2.3.nix {
bootPkgs =
# aarch64 ghc8107Binary exceeds max output size on hydra
if stdenv.isAarch64 || stdenv.isAarch32 then
if stdenv.hostPlatform.isAarch then
packages.ghc8107BinaryMinimal
else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
packages.ghc8107