Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghcjs.ghcWithPackages fails with "error: value is a path while a set was expected" for certain packages #158600

Closed
rzetterberg opened this issue Feb 8, 2022 · 9 comments
Labels

Comments

@rzetterberg
Copy link
Member

Describe the bug

When I run:

nix-shell -p 'pkgs.haskell.packages.ghcjs.ghcWithPackages (p: with p; [ reflex ])'

I get the following error:

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 problem does not happen if I run:

nix-shell -p 'pkgs.haskell.packages.ghcjs.ghcWithPackages (p: with p; [ base ])'

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.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.93, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.5.0pre20211206_d1aaa7e`
 - channels(zed): `""`
 - channels(root): `"nixos-21.11.335665.0f316e4d72d"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@rzetterberg rzetterberg added the 0.kind: bug Something is broken label Feb 8, 2022
@sternenseemann
Copy link
Member

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

@rzetterberg
Copy link
Member Author

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:

  • Produces error:
    • reflex
    • reflex-dom
    • warp
    • wai-extra
    • wai-app-static
    • http-reverse-proxy
    • aeson
  • Does not produce error:
    • wai
    • text
    • containers
    • resourcet
    • blaze-builder
    • blaze-html
    • http-client
    • bytestring
    • case-insensitive

@cdepillabout
Copy link
Member

cc @dfordivam

@dfordivam
Copy link
Contributor

@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;}'

@rzetterberg
Copy link
Member Author

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 😝

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?

@rzetterberg
Copy link
Member Author

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)

sternenseemann added a commit that referenced this issue Apr 5, 2022
Fixes evaluation of haskell.compiler.ghcjs.withPackages.

Reference #158600.
@sternenseemann
Copy link
Member

This seems to be fixed by a964dca, 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).

@sternenseemann
Copy link
Member

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: haskell-hvr/text-short#5

@rzetterberg
Copy link
Member Author

Thank you, @sternenseemann! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants