How to use a library external to the haskell environment

I develop a haskell program but found a bug in a third-party (haskell) library thus I am editing both at once to debug the issue at hand.
Thus I am in my program haskell environment created via haskell.shellFor and would like ghc to pick up the library from my local fork rather than from the ghc environment.
The usual approach would be to use ghc-pkg (un)register I believe but this doesn’t work on nix because the global database is Read Only. My idea is thus to add another package database (more about databases https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/packages.html#package-databases) via export GHC_PACKAGE_PATH=“/home/teto/myfork:”.
Then I try to create the local database via ghc-pkg -v -f /home/teto/myfork recache but this cache is empty. When I list the packages ghc-pkg list -v, I can that my database is taken into account but the package is not listed

db stack: ["/home/teto/myfork","/nix/store/vw0miqzi5jnf657g9ydd0qbz7sznd8b6-ghc-8.6.4-with-packages/lib/ghc-8.6.4/package.conf.d"]
...
/home/teto/myfork
    (no packages)

My current question is thus “how to generate a local database containing my local haskell library fork /home/teto/myfork”.

The original goal being to edit 2 local haskell packages (one being a dependency of the other) at the same time without having to exit/recreate nix-shell environments to take into account changes from the packages.

cheers

I usually have something similar to this:

default.nix:

{ haskellPackages, fetchFromGitHub }:
let externalPackage = haskellPackages.callCabal2nix "externalPackage" (fetchFromGitHub {
  owner = "foo";
  repo = "bar";
  rev = "v0.1.1";
  sha256 = "shahere";
  }) {};
  hp = haskellPackages.extend (self: super: {
    {
      externalPackage = externalPackage;
    }});

in

hp.callCabal2nix ./. "lib" {}

@MasseR thanks but I am not sure that’s what I am looking for, the library is already packaged by nixos, my problem is how to reference a version of it in my $HOME rather than from the store so that I don’t have to regenerate my ghc environment everytime I change the library. Like python’s “develop” mode but for a haskell dependency.

I solved it with cabal old style build by tweaking the external lib version in the .cabal file so that it gets chosen even though it exists in the global ghc database.
When I configure my program, I add to the package database the local library with
$ cabal configure --package-db /mylib/dist/package.conf.inplace
and then go on.