|
236 | 236 | dontInstall = true;
|
237 | 237 | };
|
238 | 238 |
|
239 |
| - # Create a development shell of hls project |
240 |
| - # See https://github.com/NixOS/nixpkgs/blob/5d4a430472cafada97888cc80672fab255231f57/pkgs/development/haskell-modules/make-package-set.nix#L319 |
241 |
| - mkDevShell = hpkgs: cabalProject: |
242 |
| - with pkgs; |
243 |
| - hpkgs.shellFor { |
244 |
| - doBenchmark = true; |
245 |
| - packages = p: |
246 |
| - with builtins; |
247 |
| - map (name: p.${name}) (attrNames |
248 |
| - # Disable dependencies should not be part of the shell. |
249 |
| - (removeAttrs hlsSources (hpkgs.hlsDisabledPlugins or []))); |
250 |
| - # For theses tools packages, we use ghcDefault |
251 |
| - # This removes a rebuild with a different GHC version |
252 |
| - # Theses programs are tools, used as binary, independently of the |
253 |
| - # version of GHC. |
254 |
| - # The drawback of this approach is that our shell may pull two GHC |
255 |
| - # version in scope (the `ghcDefault` one, and the one defined in |
256 |
| - # `hpkgs`.) |
257 |
| - # The advantage is that we won't have to rebuild theses tools (and |
258 |
| - # dependencies) with a recent GHC which may not be supported by |
259 |
| - # them. |
260 |
| - buildInputs = [ gmp zlib ncurses capstone tracy (gen-hls-changelogs ghcDefault) pythonWithPackages ] |
261 |
| - ++ [ |
262 |
| - pkgs.cabal-install |
263 |
| - ghcDefault.hie-bios |
264 |
| - hlint |
265 |
| - # ormolu |
266 |
| - # stylish-haskell |
267 |
| - ghcDefault.opentelemetry-extra |
268 |
| - ]; |
| 239 | + mkDevShell = hpkgs: cabalProject: with pkgs; mkShell { |
| 240 | + # For theses tools packages, we use ghcDefault |
| 241 | + # This removes a rebuild with a different GHC version |
| 242 | + # Theses programs are tools, used as binary, independently of the |
| 243 | + # version of GHC. |
| 244 | + # The drawback of this approach is that our shell may pull two GHC |
| 245 | + # version in scope (the default one, and the one defined in |
| 246 | + # `hpkgs`.) |
| 247 | + # The advantage is that we won't have to rebuild theses tools (and |
| 248 | + # dependencies) with a recent GHC which may not be supported by |
| 249 | + # them. |
| 250 | + buildInputs = [ |
| 251 | + # our compiling toolchain |
| 252 | + hpkgs.ghc |
| 253 | + pkgs.cabal-install |
| 254 | + # @guibou: I'm not sure hie-bios is needed |
| 255 | + ghcDefault.hie-bios |
| 256 | + # Dependencies needed to build some parts of hackage |
| 257 | + gmp zlib ncurses |
| 258 | + # Changelog tooling |
| 259 | + (gen-hls-changelogs ghcDefault) |
| 260 | + # For the documentation |
| 261 | + pythonWithPackages |
| 262 | + # @guibou: I'm not sure this is needed. |
| 263 | + hlint |
| 264 | + ghcDefault.opentelemetry-extra |
| 265 | + capstone tracy |
| 266 | + # ormolu |
| 267 | + # stylish-haskell |
| 268 | + ]; |
269 | 269 |
|
270 |
| - src = null; |
271 |
| - shellHook = '' |
272 |
| - export LD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib |
273 |
| - export DYLD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib |
274 |
| - export PATH=$PATH:$HOME/.local/bin |
275 |
| - ${(pre-commit-check ghcDefault).shellHook} |
276 | 270 |
|
277 |
| - alias cabal='cabal --project-file=${cabalProject}' |
278 |
| - ''; |
279 |
| - }; |
| 271 | + shellHook = '' |
| 272 | + # @guibou: I'm not sure theses lines are needed |
| 273 | + export LD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib |
| 274 | + export DYLD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib |
| 275 | + export PATH=$PATH:$HOME/.local/bin |
| 276 | +
|
| 277 | + # Enable the shell hooks |
| 278 | + ${(pre-commit-check ghcDefault).shellHook} |
| 279 | +
|
| 280 | + # If the cabal project file is not the default one. |
| 281 | + # Print a warning and generate an alias. |
| 282 | + if [ ${cabalProject} != "cabal.project" ] |
| 283 | + then |
| 284 | + echo "Cabal won't be able to build your project without using the project file "${cabalProject}", such as:" |
| 285 | + echo " cabal --project-file=${cabalProject}" |
| 286 | + echo "An alias "cabal_project" is available. Use it like:" |
| 287 | + echo " cabal_project build" |
| 288 | +
|
| 289 | + alias cabal_project='cabal --project-file=${cabalProject}' |
| 290 | + fi |
| 291 | + ''; |
| 292 | + }; |
280 | 293 | # Create a hls executable
|
281 | 294 | # Copied from https://github.com/NixOS/nixpkgs/blob/210784b7c8f3d926b7db73bdad085f4dc5d79418/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix#L16
|
282 | 295 | mkExe = hpkgs:
|
|
0 commit comments