treewide: simplify exec format conditionals

Changed files
+16 -26
pkgs
build-support
alternatives
blas
lapack
development
compilers
rust
libraries
boost
gstreamer
openssl
quictls
python-modules
glean-sdk
tools
misc
binutils
catppuccin-catwalk
stdenv
generic
top-level
+2 -2
pkgs/build-support/alternatives/blas/default.nix
··· 80 80 cp -L "$libblas" $out/lib/libblas${canonicalExtension} 81 81 chmod +w $out/lib/libblas${canonicalExtension} 82 82 83 - '' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then '' 83 + '' + (if stdenv.hostPlatform.isElf then '' 84 84 patchelf --set-soname libblas${canonicalExtension} $out/lib/libblas${canonicalExtension} 85 85 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libblas${canonicalExtension} 86 86 '' else lib.optionalString (stdenv.hostPlatform.isDarwin) '' ··· 112 112 cp -L "$libcblas" $out/lib/libcblas${canonicalExtension} 113 113 chmod +w $out/lib/libcblas${canonicalExtension} 114 114 115 - '' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then '' 115 + '' + (if stdenv.hostPlatform.isElf then '' 116 116 patchelf --set-soname libcblas${canonicalExtension} $out/lib/libcblas${canonicalExtension} 117 117 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libcblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libcblas${canonicalExtension} 118 118 '' else lib.optionalString stdenv.hostPlatform.isDarwin ''
+2 -2
pkgs/build-support/alternatives/lapack/default.nix
··· 57 57 cp -L "$liblapack" $out/lib/liblapack${canonicalExtension} 58 58 chmod +w $out/lib/liblapack${canonicalExtension} 59 59 60 - '' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") '' 60 + '' + (lib.optionalString stdenv.hostPlatform.isElf '' 61 61 patchelf --set-soname liblapack${canonicalExtension} $out/lib/liblapack${canonicalExtension} 62 62 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapack${canonicalExtension}):${lapackProvider'}/lib" $out/lib/liblapack${canonicalExtension} 63 63 '') + '' ··· 86 86 cp -L "$liblapacke" $out/lib/liblapacke${canonicalExtension} 87 87 chmod +w $out/lib/liblapacke${canonicalExtension} 88 88 89 - '' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") '' 89 + '' + (lib.optionalString stdenv.hostPlatform.isElf '' 90 90 patchelf --set-soname liblapacke${canonicalExtension} $out/lib/liblapacke${canonicalExtension} 91 91 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapacke${canonicalExtension}):${lib.getLib lapackProvider'}/lib" $out/lib/liblapacke${canonicalExtension} 92 92 '') + ''
+1 -2
pkgs/development/compilers/rust/cargo.nix
··· 98 98 # Disable check phase as there are failures (4 tests fail) 99 99 doCheck = false; 100 100 101 - doInstallCheck = !stdenv.hostPlatform.isStatic && 102 - stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf; 101 + doInstallCheck = !stdenv.hostPlatform.isStatic && stdenv.hostPlatform.isElf; 103 102 installCheckPhase = '' 104 103 runHook preInstallCheck 105 104 readelf -a $out/bin/.cargo-wrapped | grep -F 'Shared library: [libcurl.so'
+1 -2
pkgs/development/libraries/boost/generic.nix
··· 73 73 else if stdenv.hostPlatform.parsed.cpu.name == "s390x" then "s390x" 74 74 else toString stdenv.hostPlatform.parsed.cpu.family}" 75 75 # env in host triplet for Mach-O is "macho", but boost binary format for Mach-O is "mach-o" 76 - "binary-format=${if stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.macho 77 - then "mach-o" 76 + "binary-format=${if stdenv.hostPlatform.isMacho then "mach-o" 78 77 else toString stdenv.hostPlatform.parsed.kernel.execFormat.name}" 79 78 "target-os=${toString stdenv.hostPlatform.parsed.kernel.name}" 80 79
+1 -1
pkgs/development/libraries/gstreamer/rs/default.nix
··· 234 234 ''; 235 235 236 236 doInstallCheck = (lib.elem "webp" selectedPlugins) && !stdenv.hostPlatform.isStatic && 237 - stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf; 237 + stdenv.hostPlatform.isElf; 238 238 installCheckPhase = '' 239 239 runHook preInstallCheck 240 240 readelf -a $out/lib/gstreamer-1.0/libgstrswebp.so | grep -F 'Shared library: [libwebpdemux.so'
+1 -1
pkgs/development/libraries/openssl/default.nix
··· 93 93 else if stdenv.hostPlatform.isBSD 94 94 then if stdenv.hostPlatform.isx86_64 then "./Configure BSD-x86_64" 95 95 else if stdenv.hostPlatform.isx86_32 96 - then "./Configure BSD-x86" + lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") "-elf" 96 + then "./Configure BSD-x86" + lib.optionalString stdenv.hostPlatform.isElf "-elf" 97 97 else "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}" 98 98 else if stdenv.hostPlatform.isMinGW 99 99 then "./Configure mingw${lib.optionalString
+1 -1
pkgs/development/libraries/quictls/default.nix
··· 90 90 else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_64 91 91 then "./Configure BSD-x86_64" 92 92 else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_32 93 - then "./Configure BSD-x86" + lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") "-elf" 93 + then "./Configure BSD-x86" + lib.optionalString stdenv.hostPlatform.isElf "-elf" 94 94 else if stdenv.hostPlatform.isBSD 95 95 then "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}" 96 96 else if stdenv.hostPlatform.isMinGW
+1 -1
pkgs/development/python-modules/glean-sdk/default.nix
··· 66 66 "test_flipping_upload_enabled_respects_order_of_events" 67 67 ]; 68 68 69 - postInstallCheck = lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf) '' 69 + postInstallCheck = lib.optionalString stdenv.hostPlatform.isElf '' 70 70 readelf -a $out/${python.sitePackages}/glean/libglean_ffi.so | grep -F 'Shared library: [liblmdb.so' 71 71 ''; 72 72
+2 -6
pkgs/development/tools/misc/binutils/2.38/default.nix
··· 1 - let 2 - execFormatIsELF = platform: platform.parsed.kernel.execFormat.name == "elf"; 3 - in 4 - 5 1 { stdenv 6 2 , autoreconfHook 7 3 , autoconf269, automake, libtool ··· 18 14 , texinfo 19 15 , zlib 20 16 21 - , enableGold ? execFormatIsELF stdenv.targetPlatform 17 + , enableGold ? stdenv.targetPlatform.isElf 22 18 , enableShared ? !stdenv.hostPlatform.isStatic 23 19 # WARN: Enabling all targets increases output size to a multiple. 24 20 , withAllTargets ? false ··· 26 22 27 23 # WARN: configure silently disables ld.gold if it's unsupported, so we need to 28 24 # make sure that intent matches result ourselves. 29 - assert enableGold -> execFormatIsELF stdenv.targetPlatform; 25 + assert enableGold -> stdenv.targetPlatform.isElf; 30 26 31 27 32 28 let
+1 -1
pkgs/development/tools/misc/binutils/default.nix
··· 1 1 let 2 - withGold = platform: platform.parsed.kernel.execFormat.name == "elf" && !platform.isRiscV && !platform.isLoongArch64; 2 + withGold = platform: platform.isElf && !platform.isRiscV && !platform.isLoongArch64; 3 3 in 4 4 5 5 { stdenv
+1 -2
pkgs/development/tools/misc/catppuccin-catwalk/default.nix
··· 31 31 --fish <("$out/bin/catwalk" completion fish) 32 32 ''; 33 33 34 - doInstallCheck = !stdenv.hostPlatform.isStatic && 35 - stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf; 34 + doInstallCheck = !stdenv.hostPlatform.isStatic && stdenv.hostPlatform.isElf; 36 35 installCheckPhase = '' 37 36 runHook preInstallCheck 38 37 readelf -a $out/bin/catwalk | grep -F 'Shared library: [libwebp.so'
+1 -1
pkgs/stdenv/generic/default.nix
··· 109 109 # there (yet?) so it goes here until then. 110 110 preHook = preHook + lib.optionalString buildPlatform.isDarwin '' 111 111 export NIX_DONT_SET_RPATH_FOR_BUILD=1 112 - '' + lib.optionalString (hostPlatform.isDarwin || (hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.elf && hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.macho)) '' 112 + '' + lib.optionalString (hostPlatform.isDarwin || (!hostPlatform.isElf && !hostPlatform.isMacho)) '' 113 113 export NIX_DONT_SET_RPATH=1 114 114 export NIX_NO_SELF_RPATH=1 115 115 '' + lib.optionalString (hostPlatform.isDarwin && hostPlatform.isMacOS) ''
+1 -4
pkgs/top-level/all-packages.nix
··· 21575 21575 mtrace = callPackage ../development/libraries/glibc/mtrace.nix { }; 21576 21576 21577 21577 # Provided by libc on Operating Systems that use the Extensible Linker Format. 21578 - elf-header = 21579 - if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" 21580 - then null 21581 - else elf-header-real; 21578 + elf-header = if stdenv.hostPlatform.isElf then null else elf-header-real; 21582 21579 21583 21580 elf-header-real = callPackage ../development/libraries/elf-header { }; 21584 21581