Install i3pystatus and resolve its dependencies

I’m trying to install i3pystatus package.

Problem #1

The problem with this package is it acts as a library as same as a packages.
It should be imported in a python file to configure it (I need to do it away from nix-shell as this is a package not a development environment)

Problem #2

It depends on a library called python-dbus which can’t be seen by i3pystatus

Problem #3

It depends on a pip package called xkbgroup, how can I add it to i3pystatus

you can pass extraLibs when overriding the package https://github.com/NixOS/nixpkgs/blob/b43744b933074157273bd0f9490a46fcb601ee78/pkgs/applications/window-managers/i3/pystatus.nix#L1

I’m sorry I’m new to Nix world, so I didn’t try override before.
and Is this solution help me at the 3 problems ?

i3pystatus is a bit of an awkward package in that regard. Most packages can be installed like this or configured via some modules. With i3pystatus you have to “change” (or rather to override) the default package to include the dependencies you need.

The recommanded way would be to override the default one in an overlay see https://nixos.wiki/wiki/Overlays .

For instance with this file (not tested).

self: super: {
        i3pystatus = super.i3pystatus.override ({ extraLibs = with super.python3Packages; [ pytz notmuch dbus-python <your own deps> ]; });
}

according to your answer @teto and some search in digging.
I got this

nixpkgs.config = {
    packageOverrides = pkgs: {
      i3pystatus = pkgs.i3pystatus.overrideAttrs (oldAttrs: { 
        propagatedBuildInputs = [pkgs.python37Packages.dbus-python] ++ oldAttrs.propagatedBuildInputs;
      });
    };
  };

Now I need to find a way to add a pip package xkbgroup into this override somehow