Skip to content

Commit 3436075

Browse files
committed
llvmPackages_15.llvm: specify some deps explicitly to fix cross-compilation
The two scenarios described within where splicing doesn't handle selecting the right package for us are observable in the following (nix repl session): ``` > np = import <nixpkgs> { system = "x86_64-linux"; crossSystem = { config = "aarch64-linux"; }; } > np.__splicedPackages.hello ? __spliced true > np.__splicedPackages.python3Packages.psutil ? __spliced true > np.__splicedPackages.python3.pkgs.psutil ? __spliced false > (np.__splicedPackages.python3.withPackages (ps: with ps; [psutil])) ? __spliced false ``` See: #211340
1 parent 5e5ed7d commit 3436075

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

pkgs/development/compilers/llvm/15/llvm/default.nix

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
, darwin
88
, ninja
99
, python3
10+
, python3Packages
1011
, libffi
1112
, libbfd
1213
, libpfm
@@ -55,9 +56,12 @@ let
5556
# So, we "manually" assemble one python derivation for the package to depend
5657
# on, taking into account whether checks are enabled or not:
5758
python = if doCheck then
59+
# Note that we _explicitly_ ask for a python interpreter for our host
60+
# platform here; the splicing that would ordinarily take care of this for
61+
# us does not seem to work once we use `withPackages`.
5862
let
5963
checkDeps = ps: with ps; [ psutil ];
60-
in python3.withPackages checkDeps
64+
in pkgsBuildBuild.targetPackages.python3.withPackages checkDeps
6165
else python3;
6266

6367
in stdenv.mkDerivation (rec {
@@ -79,7 +83,11 @@ in stdenv.mkDerivation (rec {
7983
outputs = [ "out" "lib" "dev" "python" ];
8084

8185
nativeBuildInputs = [ cmake ninja python ]
82-
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
86+
++ optionals enableManpages [
87+
# Note: we intentionally use `python3Packages` instead of `python3.pkgs`;
88+
# splicing does *not* work with the latter. (TODO: fix)
89+
python3Packages.sphinx python3Packages.recommonmark
90+
];
8391

8492
buildInputs = [ libxml2 libffi ]
8593
++ optional enablePFM libpfm; # exegesis

0 commit comments

Comments
 (0)