Screenshot with mss in python says "No X11 Library"

Hi and thank you for your detailed answer. Very much appreciate it.
But unfortunately this also does also not work within propagatedBuildInputs. (though I figured out the difference now :slight_smile:

Tried to use it from the python interpreter and found that this:

#!/usr/bin/env python3
import ctypes.util
x11 = ctypes.util.find_library("X11")
if not x11:
    print("No X11.")

Needs LD_LIBRARY_PATH to be set correctly:

[I] ➜ .config/nixpkgs/bin/minimal.py
No X11.

[I] ➜ LD_LIBRARY_PATH=/nix/store/7gxlcshan16fym2ay98zmpi9gz7sjkdx-libX11-1.7.0/lib .config/nixpkgs/bin/minimal.py

And then i found out running it like this makes it work:

LD_LIBRARY_PATH=$HOME/.nix-profile/lib .config/nixpkgs/bin/minimal.py

I’ll then just set this in the script calling it.
But I’m confused.
Where should this be set?
In the lib package? I tried this but didn’t have an effect:

  propagatedBuildInputs = [
    xorg.libX11
    xorg.xrandr
  ];
  LD_LIBRARY_PATH = "${lib.makeLibraryPath propagatedBuildInputs}";

probably that path is also build time only.