Need help getting python application working with poetry2nix

I’ve had a lot of trouble setting up a python dev environment on NixOS, but I think poetry and poetry2nix are the closest I’ve been able to get. The project I want to build is using pyside6 for qt bindings, so I’ve started with a minimal environment with just pyside6 as a dependency. My flake is as follows:

{
  description = "Python application packaged using poetry2nix";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    poetry2nix.url = "github:nix-community/poetry2nix";
  };

  outputs = { self, nixpkgs, poetry2nix }:
    let
      system = "x86_64-linux";  # Adjust for your system
      pkgs = nixpkgs.legacyPackages.${system};
      inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
    in {
      packages.${system}.default = mkPoetryApplication {
        projectDir = ./.;
      };

      apps.${system}.default = {
        type = "app";
        program = "${self.packages.${system}.default}/bin/app";
      };

      devShells.${system}.default = pkgs.mkShell {
        packages = [ pkgs.poetry pkgs.stdenv.cc.cc.lib ];
        LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
          pkgs.stdenv.cc.cc.lib
        ];
        buildInputs = [ 
          pkgs.qt6.qtbase 
        ];
      };
    };
}

And my pyproject.toml

[tool.poetry]
name = "poetrytest"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "<=3.11.9,>=3.9"
pyside6 = "^6.7.1"

[tool.poetry.group.dev.dependencies]
pyside6-stubs = "^6.4.2.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
app = "package.app:run"

The problem is when running nix run . auto-patchelf fails to find many dependencies, and attempting to add the packages that seem related does not help. Here’s an excerpt from the nix log:

warn: auto-patchelf ignoring missing libQt6Quick3DUtils.so.6 wanted by /nix/store/ifpdk2gpwi9llk93nrr6ppdxymsj0lcz-python3.11-pyside6-essentials-6.7.2/lib/python3.11/site-packages/PySide6/Qt/plugins/qmltooling/libqmldbg_quick3dprofiler.so
warn: auto-patchelf ignoring missing libQt6WebEngineWidgets.so.6 wanted by /nix/store/ifpdk2gpwi9llk93nrr6ppdxymsj0lcz-python3.11-pyside6-essentials-6.7.2/lib/python3.11/site-packages/PySide6/Qt/plugins/designer/libqwebengineview.so
warn: auto-patchelf ignoring missing libQt6WebEngineCore.so.6 wanted by /nix/store/ifpdk2gpwi9llk93nrr6ppdxymsj0lcz-python3.11-pyside6-essentials-6.7.2/lib/python3.11/site-packages/PySide6/Qt/plugins/designer/libqwebengineview.so
warn: auto-patchelf ignoring missing libQt6WebChannel.so.6 wanted by /nix/store/ifpdk2gpwi9llk93nrr6ppdxymsj0lcz-python3.11-pyside6-essentials-6.7.2/lib/python3.11/site-packages/PySide6/Qt/plugins/designer/libqwebengineview.so
warn: auto-patchelf ignoring missing libQt6Positioning.so.6 wanted by /nix/store/ifpdk2gpwi9llk93nrr6ppdxymsj0lcz-python3.11-pyside6-essentials-6.7.2/lib/python3.11/site-packages/PySide6/Qt/plugins/designer/libqwebengineview.so
warn: auto-patchelf ignoring missing libQt6VirtualKeyboard.so.6 wanted by /nix/store/ifpdk2gpwi9llk93nrr6ppdxymsj0lcz-python3.11-pyside6-essentials-6.7.2/lib/python3.11/site-packages/PySide6/Qt/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so
warn: auto-patchelf ignoring missing libQt6EglFsKmsGbmSupport.so.6 wanted by /nix/store/ifpdk2gpwi9llk93nrr6ppdxymsj0lcz-python3.11-pyside6-essentials-6.7.2/lib/python3.11/site-packages/PySide6/Qt/plugins/egldeviceintegrations/libqeglfs-kms-integration.so
error: auto-patchelf could not satisfy dependency libgbm.so.1 wanted by /nix/store/ifpdk2gpwi9llk93nrr6ppdxymsj0lcz-python3.11-pyside6-essentials-6.7.2/lib/python3.11/site-packages/PySide6/Qt/plugins/egldeviceintegrations/libqeglfs-kms-integration.so

There are 35 failed dependencies altogether, but I only see the one error at the end of the excerpt, and the rest are warnings. As I said, I’ve tried adding various related packages to buildInputs to see if they would bring in the necessary files, but with no luck. I’ve also tried an override for pyside6 similarly. I’m still pretty inexperienced with nix, but I have been running NixOS for a while. If there are any experts in poetry2nix out there, any help is greatly appreciated!

It’s been five months since you posted but I’ll reply with what I know about this.

poetry2nix currently works for PySide6 v6.6 but not PySide6 v6.7. If you downgrade to PySide6 v6.6 then I expect it will work for you.

poetry2nix already declares the Qt dependencies so you don’t need to depend on qtbase in your devShell.