I am trying to build a haskell executable that depends on 2 internal libraries (basically just splitting the project up into components). Unfortunately nix can’t seem to find these.
This is the flake config:
hsPkgs = pkgs.haskell.packages.${compilerVersion}.override {
overrides = hfinal: hprev: {
## Project
servicehub =
pkgs.haskell.lib.justStaticExecutables
(hfinal.callCabal2nix "servicehub" ./. {});
# External Packages
...
};
};
here is the (abridged) cabal file:
library database
hs-source-dirs: components/database
library server
build-depends: database
hs-source-dirs: components/server
executable servicehub
hs-source-dirs: app
build-depends: server
Here is the error when I run nix build
λ nix build
error: builder for '/nix/store/aay69s3mj7cp9w8bgh1dc88avzrijc0q-servicehub-0.drv' failed with exit code 1;
last 10 log lines:
> [2 of 2] Linking Setup
> configuring
> configureFlags: --verbose --prefix=/nix/store/a7xwcjyiffyglnsr8jpb9hn1z1lvpp7i-servicehub-0 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --with-gcc=gcc --package-db=/build/tmp.9iO5ilwQ3J/package.conf.d --ghc-options=-j16 +RTS -A64M -RTS --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --ghc-option=-split-sections --extra-lib-dirs=/nix/store/q5mhssfls6iych80439511vz7539gd95-ncurses-6.4/lib --extra-lib-dirs=/nix/store/zi3wndir89vvbly8fkdwvq9v17vrpw8h-libffi-3.4.4/lib --extra-lib-dirs=/nix/store/q7ax2400mx46afnkcbfxfjddzgl4ck44-gmp-with-cxx-6.2.1/lib
> Using Parsec parser
> Configuring servicehub-0...
> CallStack (from HasCallStack):
> withMetadata, called at libraries/Cabal/Cabal/src/Distribution/Simple/Utils.hs:370:14 in Cabal-3.8.1.0:Distribution.Simple.Utils
> Error: Setup: Encountered missing or private dependencies:
> database, server
>
For full logs, run 'nix log /nix/store/aay69s3mj7cp9w8bgh1dc88avzrijc0q-servicehub-0.drv'.