Packaging python GUI app

I’m trying to package oblogout in nix.
I wrote this as default.nix

{ pkgs ? import <nixpkgs> {} }:

with pkgs;
python3.pkgs.buildPythonPackage rec {
  pname = "oblogout";
  version = "0.03";
  src = ./.;
  # src = fetchFromGitHub {
  #   owner = "trizen";
  #   repo = "oblogout-py3";
  #   rev = "0.03";
  #   sha256 = "sha256-BK8TtCubhrNsXyR83FkXZHlqIO5/sB5TTgDKsbq4vjU";
  # };

  buildInputs = [
    gtk3
    glib
    wrapGAppsHook
    gobject-introspection
    cairo
    python3Packages.pygobject3
    python3Packages.pillow
    python3Packages.dbus-python
    python3Packages.pycairo
    python3Packages.distutils_extra
    python3Packages.setuptools
  ];

  nativeBuildInputs = [
    intltool
    file
    gtk3
    glib
    pkgconfig
    gobject-introspection
    wrapGAppsHook
    python3Packages.distutils_extra
    python3Packages.setuptools
  ];

  meta = with python3Packages; {
    homepage = https://github.com/trizen/oblogout-py3;
    description = "A graphical session logout utility";
    maintainers = with maintainers; [ trizen ];
  };
}

After this when I run nix-build it succeeds and produces a result directory, then I use nix-env -i ./result to install the app it works fine too. But then when I run it with oblogout commnad it gives this error

Traceback (most recent call last):
  File "/nix/store/d6xybl3sq24qa2qwqzhllhq20wpd0ifd-python3.10-oblogout-0.03/bin/..oblogout-wrapped-wrapped", line 104, in <module>
    sys.exit(main())
  File "/nix/store/d6xybl3sq24qa2qwqzhllhq20wpd0ifd-python3.10-oblogout-0.03/bin/..oblogout-wrapped-wrapped", line 79, in main
    from oblogout import OpenboxLogout
  File "/nix/store/d6xybl3sq24qa2qwqzhllhq20wpd0ifd-python3.10-oblogout-0.03/lib/python3.10/site-packages/oblogout/__init__.py", line 40, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'

Why is gi not present even after it being present in buildInputs (as I understand, packages in buildInputs are linked against binary in runtime)

buildPythonPackage expects Python modules in propagatedBuildInputs.

You should also use buildPythonApplication for programs instead of buildPythonPackage.

I’ve edited default.nix to

{ pkgs ? import <nixpkgs> {} }:
let
    src = pkgs.fetchFromGitHub {
        owner = "trizen";
        repo = "oblogout-py3";
        rev = "0.03";
        sha256 = "sha256-BK8TtCubhrNsXyR83FkXZHlqIO5/sB5TTgDKsbq4vjU";
    };
in
with pkgs;
python3.pkgs.buildPythonApplication {
    pname = "oblogout";
    version = "0.03";
    src = src;
    buildInputs = [
        gtk3
        glib
        wrapGAppsHook
        gobject-introspection
        cairo
    ];
    nativeBuildInputs = [
        intltool
        file
        gtk3
        glib
        pkgconfig
        gobject-introspection
        wrapGAppsHook
    ];
    propagatedBuildInputs = with python3Packages; [
        distutils_extra
        setuptools
        pygobject3
        pillow
        dbus-python
        pycairo
        distutils_extra
        setuptools
    ];
    python = python3;
    dbus_python = python3Packages.dbus-python;
    meta = {
        homepage = https://github.com/trizen/oblogout-py3;
        description = "A graphical session logout utility";
        maintainers = with maintainers; [ trizen ];
    };
}

Now nix-build works, but nix-env -i ./result gives this error

installing 'oblogout-0.03'
building '/nix/store/63n243nad4yfvqnwl8iilg8wvn41iqqx-user-environment.drv'...
error: files '/nix/store/m8jhk6b5gmqa06znv2s2ppbchg07jfqi-oblogout-0.03/lib/python3.10/site-packages/etc/oblogout.conf' and '/nix/store/d6xybl3sq24qa2qwqzhllhq20wpd0ifd-python3.10-oblogout-0.03/lib/python3.10/site-packages/etc/oblogout.conf' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' or type 'nix profile install --help' if using 'nix profile' to find out howto change the priority of one of the conflicting packages (0 being the highest priority)
error: builder for '/nix/store/63n243nad4yfvqnwl8iilg8wvn41iqqx-user-environment.drv' failed with exit code 1;
       last 1 log lines:
       > error: files '/nix/store/m8jhk6b5gmqa06znv2s2ppbchg07jfqi-oblogout-0.03/lib/python3.10/site-packages/etc/oblogout.conf' and '/nix/store/d6xybl3sq24qa2qwqzhllhq20wpd0ifd-python3.10-oblogout-0.03/lib/python3.10/site-packages/etc/oblogout.conf' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' or type 'nix profile install --help' if using 'nix profile' to find out howto change the priority of one of the conflicting packages (0 being the highest priority)
       For full logs, run 'nix log /nix/store/63n243nad4yfvqnwl8iilg8wvn41iqqx-user-environment.drv'.

I did try out nix-env --set-flag priority 10 oblogout-0.03 but it doesn’t work either