about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorRahul Butani <rrbutani@users.noreply.github.com>2022-10-05 10:24:18 -0500
committerRahul Butani <rrbutani@users.noreply.github.com>2023-01-27 13:29:22 -0800
commit6d0c87602fe3281571f0bfaf1fe53822026d1da1 (patch)
tree37b969914616831df69f9a73f3364af3014cb4b8 /pkgs/development/compilers
parent2a58596dd2484924730ea43110966fe16d2abba7 (diff)
downloadnixlib-6d0c87602fe3281571f0bfaf1fe53822026d1da1.tar
nixlib-6d0c87602fe3281571f0bfaf1fe53822026d1da1.tar.gz
nixlib-6d0c87602fe3281571f0bfaf1fe53822026d1da1.tar.bz2
nixlib-6d0c87602fe3281571f0bfaf1fe53822026d1da1.tar.lz
nixlib-6d0c87602fe3281571f0bfaf1fe53822026d1da1.tar.xz
nixlib-6d0c87602fe3281571f0bfaf1fe53822026d1da1.tar.zst
nixlib-6d0c87602fe3281571f0bfaf1fe53822026d1da1.zip
llvmPackages_15.llvm: add in a missing check dep
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/llvm/15/llvm/default.nix30
1 files changed, 28 insertions, 2 deletions
diff --git a/pkgs/development/compilers/llvm/15/llvm/default.nix b/pkgs/development/compilers/llvm/15/llvm/default.nix
index b4a441753b93..4cb93b84dae7 100644
--- a/pkgs/development/compilers/llvm/15/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/15/llvm/default.nix
@@ -17,6 +17,7 @@
 , which
 , buildLlvmTools
 , debugVersion ? false
+, doCheck ? true
 , enableManpages ? false
 , enableSharedLibraries ? !stdenv.hostPlatform.isStatic
 , enablePFM ? stdenv.isLinux /* PFM only supports Linux */
@@ -33,6 +34,29 @@ let
   shortVersion = with lib;
     concatStringsSep "." (take 1 (splitString "." release_version));
 
+  # Ordinarily we would just the `doCheck` and `checkDeps` functionality
+  # `mkDerivation` gives us to manage our test dependencies (instead of breaking
+  # out `doCheck` as a package level attribute).
+  #
+  # Unfortunately `lit` does not forward `$PYTHONPATH` to children processes, in
+  # particular the children it uses to do feature detection.
+  #
+  # This means that python deps we add to `checkDeps` (which the python
+  # interpreter is made aware of via `$PYTHONPATH` – populated by the python
+  # setup hook) are not picked up by `lit` which causes it to skip tests.
+  #
+  # Adding `python3.withPackages (ps: [ ... ])` to `checkDeps` also doesn't work
+  # because this package is shadowed in `$PATH` by the regular `python3`
+  # package.
+  #
+  # So, we "manually" assemble one python derivation for the package to depend
+  # on, taking into account whether checks are enabled or not:
+  python = if doCheck then
+    let
+      checkDeps = ps: with ps; [ psutil ];
+    in python3.withPackages checkDeps
+  else python3;
+
 in stdenv.mkDerivation (rec {
   pname = "llvm";
   inherit version;
@@ -51,7 +75,7 @@ in stdenv.mkDerivation (rec {
 
   outputs = [ "out" "lib" "dev" "python" ];
 
-  nativeBuildInputs = [ cmake ninja python3 ]
+  nativeBuildInputs = [ cmake ninja python ]
     ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
 
   buildInputs = [ libxml2 libffi ]
@@ -59,7 +83,9 @@ in stdenv.mkDerivation (rec {
 
   propagatedBuildInputs = [ ncurses zlib ];
 
-  nativeCheckInputs = [ which ];
+  nativeCheckInputs = [
+    which
+  ] ++ lib.optional stdenv.isDarwin sysctl;
 
   patches = [
     ./gnu-install-dirs.patch