Closed rzetterberg closed 2 years ago
I believe withPackages
is just not supported for ghcjs
at all, base
is a pseudo package and will just be reuse the bundled one. Have you been able to use any package that is not bundled with GHC?
cc @dfordivam
I wasn't sure which packages were bundled, so I tried 16 packages (one by one) from one of my projects. Here are the results:
reflex
reflex-dom
warp
wai-extra
wai-app-static
http-reverse-proxy
aeson
wai
text
containers
resourcet
blaze-builder
blaze-html
http-client
bytestring
case-insensitive
cc @dfordivam
@rzetterberg I tried this with latest nixpkgs and did not observe this issue. But I did observe another problem, the ghcjs
is not available in the shell created by ghcWithPackages
.
I also gave haskell.packages.ghcjs.developPackage
a try on a cabal package using reflex-dom
. That worked when withHoogle
is set to false
. I could get the shell with ghcjs
and the cabal build
succedded.
nix-shell -E 'with import ~/latest-nixpkgs { }; haskell.packages.ghcjs.developPackage { root = ./.; withHoogle = false;}'
Thanks for the reply, @dfordivam
I haven't really been up to speed with the haskell ecosystem in nixpkgs, so I didn't even know about developPackage
. I've used pkgs.haskellPackages.ghcWithPackages
since like 2016 :stuck_out_tongue_closed_eyes:
So, If I understand it correctly, I could take something like this:
haskell_env = pkgs.haskell.packages.ghcjs.ghcWithPackages (p: with p; [
base cabal-install reflex reflex-dom
]);
And instead use something like this:
haskell_env = pkgs.haskell.packages.ghcjs.developPackage {
root = ./.;
withHoogle = false;
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages; [
base cabal-install reflex reflex-dom
]);
};
And that should give me the ability to build a project with ghcjs
that uses the reflex
and reflex-dom
packages using cabal build
?
Here's the result for me when I tried the example you provided @dfordivam
nix-shell -E 'with import <nixpkgs> { }; haskell.packages.ghcjs.developPackage { root = ./.; withHoogle = false;}'
error: value is a path while a set was expected
at /nix/store/ivngb8kkjz9iy5ys433yf29xxn039ysl-nixos-21.11.335665.0f316e4d72d/nixos/pkgs/development/haskell-modules/lib/compose.nix:38:28:
37| */
38| overrideCabal = f: drv: (drv.override (args: args // {
| ^
39| mkDerivation = drv: (args.mkDerivation drv).override f;
(use '--show-trace' to show detailed location information)
This seems to be fixed by a964dcad739fe70ed5e01646594aafdfb2be4560, for the evaluation part, as now a withPackages
environment with all packages mentioned in your comment can be instantiated.
The remaining problem is that, well, ghcjs
can't be built at the moment (#166553).
I've tried building a few environments with ghcjs and everything seems to be working as expected. Note that none of the examples you have given in your comment can be expected to work, however, as they all depend on text-short
which doesn't support GHCJS at the moment: https://github.com/haskell-hvr/text-short/issues/5
Thank you, @sternenseemann! :1st_place_medal:
Describe the bug
When I run:
I get the following error:
This problem does not happen if I run:
then the compilation starts, like expected. Same thing if I provide an empty list of packages.
Notify maintainers
Maintainers from haskell team: @cdepillabout, @expipiplus1, @maralorn, @sternenseemann
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.