|
1 |
| -{ pkgs, runCommand, cacert, index-state-hashes, haskellLib }: |
| 1 | +{ pkgs, cacert, index-state-hashes, haskellLib }: |
2 | 2 | { name ? src.name or null # optional name for better error messages
|
3 | 3 | , src
|
4 | 4 | , materialized-dir ? ../materialized
|
|
14 | 14 | , cabalProjectFreeze ? null
|
15 | 15 | , caller ? "callCabalProjectToNix" # Name of the calling function for better warning messages
|
16 | 16 | , compilerSelection ? p: p.haskell-nix.compiler
|
17 |
| -, ghc ? null # Deprecated in favour of `compiler-nix-name` |
18 | 17 | , ghcOverride ? null # Used when we need to set ghc explicitly during bootstrapping
|
19 | 18 | , configureArgs ? "" # Extra arguments to pass to `cabal v2-configure`.
|
20 | 19 | # `--enable-tests --enable-benchmarks` are included by default.
|
|
74 | 73 | nix-tools = if args.nix-tools or null != null
|
75 | 74 | then args.nix-tools
|
76 | 75 | else evalPackages.haskell-nix.nix-tools-unchecked;
|
77 |
| - forName = pkgs.lib.optionalString (name != null) (" for " + name); |
| 76 | + |
78 | 77 | nameAndSuffix = suffix: if name == null then suffix else name + "-" + suffix;
|
79 | 78 |
|
80 | 79 | ghc' =
|
81 | 80 | if ghcOverride != null
|
82 | 81 | then ghcOverride
|
83 | 82 | else
|
84 |
| - if ghc != null |
85 |
| - then __trace ("WARNING: A `ghc` argument was passed" + forName |
86 |
| - + " this has been deprecated in favour of `compiler-nix-name`. " |
87 |
| - + "Using `ghc` will break cross compilation setups, as haskell.nix cannot " |
88 |
| - + "pick the correct `ghc` package from the respective buildPackages. " |
89 |
| - + "For example, use `compiler-nix-name = \"ghc865\";` for GHC 8.6.5.") ghc |
90 |
| - else |
91 |
| - # Do note that `pkgs = final.buildPackages` in the `overlays/haskell.nix` |
92 |
| - # call to this file. And thus `pkgs` here is the proper `buildPackages` |
93 |
| - # set and we do not need, nor should pick the compiler from another level |
94 |
| - # of `buildPackages`, lest we want to get confusing errors about the Win32 |
95 |
| - # package. |
96 |
| - # |
97 |
| - # > The option `packages.Win32.package.identifier.name' is used but not defined. |
98 |
| - # |
99 |
| - (compilerSelection pkgs)."${compiler-nix-name}"; |
| 83 | + # Do note that `pkgs = final.buildPackages` in the `overlays/haskell.nix` |
| 84 | + # call to this file. And thus `pkgs` here is the proper `buildPackages` |
| 85 | + # set and we do not need, nor should pick the compiler from another level |
| 86 | + # of `buildPackages`, lest we want to get confusing errors about the Win32 |
| 87 | + # package. |
| 88 | + # |
| 89 | + # > The option `packages.Win32.package.identifier.name' is used but not defined. |
| 90 | + # |
| 91 | + (compilerSelection pkgs)."${compiler-nix-name}"; |
100 | 92 |
|
101 | 93 | in let
|
102 | 94 | ghc = if ghc' ? latestVersion
|
@@ -519,18 +511,18 @@ let
|
519 | 511 | json_cabal_file=$(mktemp)
|
520 | 512 | cabal2json $fixed_cabal_file > $json_cabal_file
|
521 | 513 |
|
522 |
| - exposed_modules="$(jq -r '.library."exposed-modules"[]|select(type=="array")[]' $json_cabal_file)" |
523 |
| - reexported_modules="$(jq -r '.library."reexported-modules"//[]|.[]|select(type=="array")[]' $json_cabal_file)" |
| 514 | + exposed_modules="$(jq -r '.library."exposed-modules"//[]|.[]|select(type=="array")[]' $json_cabal_file)" |
| 515 | + reexported_modules="$(jq -r '.library."reexported-modules"//[]|.[]|select(type=="array")[]' $json_cabal_file | sed 's/.* as //g')" |
524 | 516 |
|
525 | 517 | # FIXME This is a bandaid. Rather than doing this, conditionals should be interpreted.
|
526 | 518 | ${pkgs.lib.optionalString pkgs.stdenv.targetPlatform.isGhcjs ''
|
527 |
| - exposed_modules+=" $(jq -r '.library."exposed-modules"[]|select(type=="object" and .if.arch == "javascript")|.then[]' $json_cabal_file)" |
| 519 | + exposed_modules+=" $(jq -r '.library."exposed-modules"//[]|.[]|select(type=="object" and .if.arch == "javascript")|.then[]' $json_cabal_file)" |
528 | 520 | ''}
|
529 | 521 | ${pkgs.lib.optionalString pkgs.stdenv.targetPlatform.isWindows ''
|
530 |
| - exposed_modules+=" $(jq -r '.library."exposed-modules"[]|select(type=="object" and .if.os == "windows")|.then[]' $json_cabal_file)" |
| 522 | + exposed_modules+=" $(jq -r '.library."exposed-modules"//[]|.[]|select(type=="object" and .if.os == "windows")|.then[]' $json_cabal_file)" |
531 | 523 | ''}
|
532 | 524 | ${pkgs.lib.optionalString (!pkgs.stdenv.targetPlatform.isWindows) ''
|
533 |
| - exposed_modules+=" $(jq -r '.library."exposed-modules"[]|select(type=="object" and .if.not.os == "windows")|.then[]' $json_cabal_file)" |
| 525 | + exposed_modules+=" $(jq -r '.library."exposed-modules"//[]|.[]|select(type=="object" and .if.not.os == "windows")|.then[]' $json_cabal_file)" |
534 | 526 | ''}
|
535 | 527 |
|
536 | 528 | EXPOSED_MODULES_${varname name}="$(tr '\n' ' ' <<< "$exposed_modules $reexported_modules")"
|
|
0 commit comments