Skip to content

JS Template Haskell hackage dependency splicing failure #2426

@ymeister

Description

@ymeister

Describe the bug

When cross-compiling to JS a hackage dependency which involves actual template haskell splicing and not just declaration of template haskell functions you get an error:

    JS interpreter: couldn't find "ghci" package

Obvious solution does not fix it:

if arch(javascript)
  extra-packages: ghci
  • Build system: x86_64-linux
  • GHC version: 9.12.2
  • Haskell.nix version (or commit) used: e567ebc (tag: 2025.08.03)

Steps To Reproduce

  1. Add th-orphans to build-depends of https://github.com/input-output-hk/haskell.nix/blob/master/test/js-template-haskell/js-template-haskell.cabal
  2. Run the build: nix-build -A allJobs.x86_64-linux.unstable.ghc9122.ghcjs.tests.js-template-haskell.build

Expected behavior

Successful compilation.

Additional context

  1. This is a regression, as last I tried using extra-packages: ghci on ghc910 it solved the problem. Now it doesn't. I assume this PR might be related to this Fix cabal install in the presence of extra-packages (backport #9719) haskell/cabal#9875.
  2. My second assumption was that it maybe somehow related to this Fix -inplace issue with ghc 9.8.1 boot packages #2161. I.e. when ghc tries to pick ghci, while it should have picked ghci-inplace. Honestly doubt that's the case, but still leaving it here for the full picture.

Hotfix:

modules = [
  ({ config, ... }: {
    configureFlags = [ "--package-db ${config.ghc.package.outPath}/${config.ghc.package.libDir}/package.conf.d" ];
  })
];

This places all installed ghc libraries, ghci in particular, in scope of all packages. Might be an overkill, but at least it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions