From 5330c0a1afe9d97d6f6366157cf0d3da9a8e7c31 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 30 Jul 2022 16:18:27 +0000 Subject: treewide: use isAarch where appropriate --- nixos/lib/qemu-common.nix | 2 +- nixos/modules/hardware/all-firmware.nix | 2 +- nixos/modules/installer/cd-dvd/iso-image.nix | 2 +- nixos/modules/profiles/all-hardware.nix | 2 +- nixos/modules/services/home-automation/home-assistant.nix | 2 +- nixos/modules/virtualisation/qemu-vm.nix | 2 +- pkgs/applications/video/vlc/default.nix | 5 ++--- pkgs/development/haskell-modules/configuration-arm.nix | 6 +++--- pkgs/development/haskell-modules/default.nix | 3 +-- pkgs/development/interpreters/j/default.nix | 2 +- pkgs/development/libraries/exiv2/default.nix | 2 +- pkgs/development/libraries/gperftools/default.nix | 4 ++-- pkgs/development/libraries/libdrm/default.nix | 2 +- pkgs/development/libraries/x264/default.nix | 2 +- pkgs/development/python-modules/afdko/default.nix | 2 +- pkgs/development/python-modules/fastnumbers/default.nix | 2 +- pkgs/development/python-modules/uvloop/default.nix | 2 +- pkgs/misc/screensavers/xscreensaver/default.nix | 2 +- pkgs/os-specific/linux/nmon/default.nix | 2 +- pkgs/os-specific/linux/rtl8189es/default.nix | 2 +- pkgs/os-specific/linux/rtl8812au/default.nix | 2 +- pkgs/shells/bash/bash-completion/default.nix | 2 +- pkgs/stdenv/generic/make-derivation.nix | 2 +- pkgs/top-level/haskell-packages.nix | 6 +++--- 24 files changed, 30 insertions(+), 32 deletions(-) diff --git a/nixos/lib/qemu-common.nix b/nixos/lib/qemu-common.nix index 250f714be0a..fc3dcb24ab9 100644 --- a/nixos/lib/qemu-common.nix +++ b/nixos/lib/qemu-common.nix @@ -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: { diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix index 89a1217dfb3..bd5540646b0 100644 --- a/nixos/modules/hardware/all-firmware.nix +++ b/nixos/modules/hardware/all-firmware.nix @@ -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") [ diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index d1ccc6c2072..f3850a593e9 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -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 = '' diff --git a/nixos/modules/profiles/all-hardware.nix b/nixos/modules/profiles/all-hardware.nix index 8347453d403..af1e3d32a0a 100644 --- a/nixos/modules/profiles/all-hardware.nix +++ b/nixos/modules/profiles/all-hardware.nix @@ -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 diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix index 2cff5051c75..1d76d2fd39c 100644 --- a/nixos/modules/services/home-automation/home-assistant.nix +++ b/nixos/modules/services/home-automation/home-assistant.nix @@ -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" diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index e87f540fd57..5b2d81eeb68 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -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 diff --git a/pkgs/applications/video/vlc/default.nix b/pkgs/applications/video/vlc/default.nix index 7fcf5f7a6b4..e870b8572d8 100644 --- a/pkgs/applications/video/vlc/default.nix +++ b/pkgs/applications/video/vlc/default.nix @@ -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 diff --git a/pkgs/development/haskell-modules/configuration-arm.nix b/pkgs/development/haskell-modules/configuration-arm.nix index 2da11c87f81..9b7811417d9 100644 --- a/pkgs/development/haskell-modules/configuration-arm.nix +++ b/pkgs/development/haskell-modules/configuration-arm.nix @@ -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: # diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix index 8392e751da2..7bc1fa0f7e8 100644 --- a/pkgs/development/haskell-modules/default.nix +++ b/pkgs/development/haskell-modules/default.nix @@ -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; }) diff --git a/pkgs/development/interpreters/j/default.nix b/pkgs/development/interpreters/j/default.nix index 7f35dcfc635..5e67986ac10 100644 --- a/pkgs/development/interpreters/j/default.nix +++ b/pkgs/development/interpreters/j/default.nix @@ -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"; diff --git a/pkgs/development/libraries/exiv2/default.nix b/pkgs/development/libraries/exiv2/default.nix index 7a79e597beb..54f42ae8db7 100644 --- a/pkgs/development/libraries/exiv2/default.nix +++ b/pkgs/development/libraries/exiv2/default.nix @@ -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 diff --git a/pkgs/development/libraries/gperftools/default.nix b/pkgs/development/libraries/gperftools/default.nix index 0ed2dea0c4c..c1dd608f805 100644 --- a/pkgs/development/libraries/gperftools/default.nix +++ b/pkgs/development/libraries/gperftools/default.nix @@ -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 '' diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix index 9f7f5fcb1d8..ec12f1031cf 100644 --- a/pkgs/development/libraries/libdrm/default.nix +++ b/pkgs/development/libraries/libdrm/default.nix @@ -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" ]; diff --git a/pkgs/development/libraries/x264/default.nix b/pkgs/development/libraries/x264/default.nix index dc2b1c40c6c..df248f6b4d4 100644 --- a/pkgs/development/libraries/x264/default.nix +++ b/pkgs/development/libraries/x264/default.nix @@ -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 ''; diff --git a/pkgs/development/python-modules/afdko/default.nix b/pkgs/development/python-modules/afdko/default.nix index 2ca94a2085a..29593503252 100644 --- a/pkgs/development/python-modules/afdko/default.nix +++ b/pkgs/development/python-modules/afdko/default.nix @@ -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" diff --git a/pkgs/development/python-modules/fastnumbers/default.nix b/pkgs/development/python-modules/fastnumbers/default.nix index 779949b38fd..5fd8115152f 100644 --- a/pkgs/development/python-modules/fastnumbers/default.nix +++ b/pkgs/development/python-modules/fastnumbers/default.nix @@ -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 diff --git a/pkgs/development/python-modules/uvloop/default.nix b/pkgs/development/python-modules/uvloop/default.nix index c3b637da067..3e877ea1a8e 100644 --- a/pkgs/development/python-modules/uvloop/default.nix +++ b/pkgs/development/python-modules/uvloop/default.nix @@ -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" diff --git a/pkgs/misc/screensavers/xscreensaver/default.nix b/pkgs/misc/screensavers/xscreensaver/default.nix index fcec51506a5..836714fb919 100644 --- a/pkgs/misc/screensavers/xscreensaver/default.nix +++ b/pkgs/misc/screensavers/xscreensaver/default.nix @@ -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 diff --git a/pkgs/os-specific/linux/nmon/default.nix b/pkgs/os-specific/linux/nmon/default.nix index 9372018f5b7..e3ab199399e 100644 --- a/pkgs/os-specific/linux/nmon/default.nix +++ b/pkgs/os-specific/linux/nmon/default.nix @@ -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" }"; diff --git a/pkgs/os-specific/linux/rtl8189es/default.nix b/pkgs/os-specific/linux/rtl8189es/default.nix index c1032473db1..a755404e6e5 100644 --- a/pkgs/os-specific/linux/rtl8189es/default.nix +++ b/pkgs/os-specific/linux/rtl8189es/default.nix @@ -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 = '' diff --git a/pkgs/os-specific/linux/rtl8812au/default.nix b/pkgs/os-specific/linux/rtl8812au/default.nix index b385b9a27da..30f04c1eb8b 100644 --- a/pkgs/os-specific/linux/rtl8812au/default.nix +++ b/pkgs/os-specific/linux/rtl8812au/default.nix @@ -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}" ]; diff --git a/pkgs/shells/bash/bash-completion/default.nix b/pkgs/shells/bash/bash-completion/default.nix index 75ded461ea6..d73afa7e2a9 100644 --- a/pkgs/shells/bash/bash-completion/default.nix +++ b/pkgs/shells/bash/bash-completion/default.nix @@ -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 \ diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 871aed59e35..73030e7d941 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -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 = diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 8856d412321..c6b36677875 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -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 -- cgit 1.4.1