systemd: disable libbpf if compiler-rt unsupported

If we can't build compiler-rt, we can't have a clang for that
platform.  Example affected architecture: s390, which is useful for
testing assumptions in Nixpkgs because it's a Linux architecture that
we can't emulate.

I've written buildPackages.targetPackages.llvmPackages even though
it's the same thing as llvmPackages because of the comment in this
file that warns people against relying on splicing for llvmPackages.
Taking llvmPackages as an input directly would make it easier for
people to make that mistake without seeing the comment.
This commit is contained in:
Alyssa Ross 2023-04-19 18:44:28 +00:00 committed by sternenseemann
parent f423f57ba6
commit 513975ec4b

View file

@ -100,6 +100,10 @@
, withLibBPF ? lib.versionAtLeast buildPackages.llvmPackages.clang.version "10.0"
&& (stdenv.hostPlatform.isAarch -> lib.versionAtLeast stdenv.hostPlatform.parsed.cpu.version "6") # assumes hard floats
&& !stdenv.hostPlatform.isMips64 # see https://github.com/NixOS/nixpkgs/pull/194149#issuecomment-1266642211
# buildPackages.targetPackages.llvmPackages is the same as llvmPackages,
# but we do it this way to avoid taking llvmPackages as an input, and
# risking making it too easy to ignore the above comment about llvmPackages.
&& lib.meta.availableOn stdenv.hostPlatform buildPackages.targetPackages.llvmPackages.compiler-rt
, withLibidn2 ? true
, withLocaled ? true
, withLogind ? true