haskell.nix
haskell.nix copied to clipboard
-fllvm and llvm?
What's the recommended way to respect the -fllvm
flag in a cabal file and, at the same time, get a correct version of LLVM included as a dep when using stack-to-nix
or cabal-to-nix
?
@o1lo01ol1o I'm afraid I don't understand the first part of your question:
What's the recommended way to respect the -fllvm flag in a cabal file for correct version of LLVM included as a dep when using stack-to-nix or cabal-to-nix? luckily most recent ghc's (while warn) will compile with a relatively wide variety of recent LLVMs. The primary issue was that LLVM changed it's textual IR representation and GHC needed to stay in lockstep with the respective LLVM version to ensure that LLVm could parse the IR ghc would produce.
In general though the dependency is
stack -> (via stack-to-nix) -> lts -> ghc version -> nixpkgs provides ghc+llvm
and similarly for cabal projects.
Note that with the overlay branch that should arrive soon, haskell.nix will provide ghc's and we won't rely on the ones provided by nixpkgs anymore.
@angerman My question was poorly specified after a long night of brute-forcing potential nix expressions. Let me see if I can rephrase.
Two potential cases:
-
One has a bunch of components that need to build with the
-fllvm
flag in cabal. For this case, we only care that the LLVM provided "work" with the ghc. As you've said, this tends to be the majority of recent LLVMs. In this case, where does one plugpkgs.llvm
in the expressions generated bystack-to-nix
orcabal-to-nix
to make llvm available? In my test project I haven't been able to figure this out, but I'm probably just missing something simple. -
In the event there's a specified version of llvm somewhere in the expressions generated by
stack-to-nix
orcabal-to-nix
and some downstream project needs a specificllvm
(say,accelerate
and LLVM 7.0) how can upstream llvm be overridden?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The LLVM use still depends on which GHC version, but it now comes from haskell.nix. For instance here is where it is set up for GHC 9.2.4 https://github.com/input-output-hk/haskell.nix/blob/7462e537efccfc4471908a5c96c5c72b2646f985/overlays/bootstrap.nix#L661-L663