From e38687605a66352ba9271b7f5b7210e730f24133 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 19 Apr 2023 18:44:28 +0000 Subject: [PATCH] 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. --- pkgs/os-specific/linux/systemd/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 57d339b0fbab9..ac03320de766f 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -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