haskell.nix/overlays/ghcjs.nix
Hamish Mackenzie 2b7d93baf6
Allow package-name:sublib-name in build-depends (#963)
With cabal 3 it should be possible to reference a sublib in the
`build-depends` of a `.cabal` file using `package-name:sublib-name`

The `cabal-sublib` test is updated to include the new type syntax
and a fix is included for the component builder.

We will need to update `plan-to-nix` in `nix-tools` as well.
For now the work around is to use a module to add the sublib to
`depends` (see `test/cabal-sublib/default.nix`).

Without this fix the `cabal-sublib:slib` was not found by
`setup configure` because only `--dependency=slib=cabal-sublib-...`
was passed.  The fix is to also pass
`--dependency=cabal-sublib:slib=cabal-sublib-...`.
2021-01-08 23:11:16 +13:00

36 lines
1.3 KiB
Nix

final: prev:
{
haskell-nix = prev.haskell-nix // ({
defaultModules = prev.haskell-nix.defaultModules ++ final.lib.optional final.stdenv.hostPlatform.isGhcjs (
({ pkgs, buildModules, config, lib, ... }: {
# Allow Cabal to be reinstalled so that custom setups will use a Cabal
# built with packages.Cabal.patches
nonReinstallablePkgs =
[ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
"deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
"ghcjs-prim" "ghcjs-th"
]
++ lib.optionals (!config.reinstallableLibGhc) [
"ghc-boot"
"ghc" "Win32" "array" "binary" "bytestring" "containers"
"directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim"
"hpc"
"mtl" "parsec" "process" "text" "time" "transformers"
"unix" "xhtml" "terminfo"
];
# Include patches for custom setups
packages.Cabal.patches = [
./patches/Cabal/Cabal-3.0.0.0-drop-pkg-db-check.diff
./patches/Cabal/Cabal-3.0.0.0-no-final-checks.diff
];
testWrapper = [((final.writeScriptBin "node-wrapper" ''
set -euo pipefail
exe=$1
shift
${final.buildPackages.nodejs}/bin/node $exe $@
'') + "/bin/node-wrapper")];
})
);
});
}