Trying to package a python script, but running it doesn't find dependency

I’m trying to create this package of a python script which depends on libnotify,
libnotify python bindings are present in nixpkgs.
However, when running the application, it cannot find the notify dependency.
How can I debug this?

with import <nixpkgs> { };

pkgs.stdenv.mkDerivation {
  name = "an2linuxserver";

  src = (pkgs.fetchFromGitHub {
    owner = "rootkiwi";
    repo = "an2linuxserver";
    rev = "58648ecbdc9d62d3e3e28484e3e7a1f12507dfdf";
    sha256 = "1x3svjx1jaxk8bbzkm7f4v7qrg3g6sgcb886kjdfkkiq2aqsmnn0";

  } + "/an2linuxserver.py");

  buildInputs = [
    (pkgs.python37.withPackages
      (pythonPackages: with pythonPackages; [ pygobject3 notify ]))
  ];
  #  propagatedBuildInputs = [  pkgs.gdk-pixbuf  ];

  unpackPhase = "true";
  installPhase = ''
    mkdir -p $out/bin
    cp $src $out/bin/an2linuxserver
    chmod +x $out/bin/an2linuxserver
  '';
  meta = with lib; {
    homepage = "https://github.com/rootkiwi/an2linuxserver";
    description =
      "Sync Android notifications encrypted using TLS to a Linux desktop over WiFi, Mobile data or Bluetooth. This is the server part of AN2Linux which will run on your computer.";
    license = licenses.gpl3Plus;
    #    maintainers = with maintainers; [ johndoe ];
  };

}

You need GI_TYPELIB_PATH environment variable, see NixOS - Nixpkgs 21.05 manual. adding wrapGappsHook and gobject-introspection to nativeBuildInputs will do that for you.

OK. So I mistakenly assumed it would depend on the python-notify package, but instead it directly depends on libnotify.

Here is the updated, working code, in case anyone wants to run AN2Linux:

with import <nixpkgs> { };

pkgs.stdenv.mkDerivation {
  name = "an2linuxserver";

  src = (pkgs.fetchFromGitHub {
    owner = "rootkiwi";
    repo = "an2linuxserver";
    rev = "58648ecbdc9d62d3e3e28484e3e7a1f12507dfdf";
    sha256 = "1x3svjx1jaxk8bbzkm7f4v7qrg3g6sgcb886kjdfkkiq2aqsmnn0";
  } + "/an2linuxserver.py");

  buildInputs = [
    (pkgs.python37.withPackages
      (pythonPackages: with pythonPackages; [ pygobject3 ]))
  ];
  nativeBuildInputs =
    [ pkgs.wrapGAppsHook pkgs.gobject-introspection pkgs.libnotify ];

  preFixup = ''
    gappsWrapperArgs+=(
      # Thumbnailers
      --prefix PATH : "${pkgs.openssl}/bin"
    )
  '';

  unpackPhase = "true";
  installPhase = ''
    mkdir -p $out/bin
    cp $src $out/bin/an2linuxserver
    chmod +x $out/bin/an2linuxserver
  '';
  meta = with lib; {
    homepage = "https://github.com/rootkiwi/an2linuxserver";
    description =
      "Sync Android notifications encrypted using TLS to a Linux desktop over WiFi, Mobile data or Bluetooth. This is the server part of AN2Linux which will run on your computer.";
    license = licenses.gpl3Plus;
    #    maintainers = with maintainers; [ johndoe ];
  };

}