Python uv + Nix-ld: "RuntimeError: Found no NVIDIA driver on your system"

I followed this wiki guide to setup uv on NixOS: https://wiki.nixos.org/wiki/Python_quickstart_using_uv. I want to run ComfyUI, I installed all the packages from the command here: uv add --requirements requirements.txtuv add --requirements requirements.txt, but when I did uv run python main.py, I got this error:

RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx
[W1030 02:44:10.188330356 AllocatorConfig.cpp:28] Warning: PYTORCH_CUDA_ALLOC_CONF is deprecated, use PYTORCH_ALLOC_CONF instead (function operator())

This is my current nix nvidia configuration:

  hardware = {
    graphics.enable = true;
    nvidia = {
      nvidiaSettings = true;
      open = true;
    };
    nvidia-container-toolkit.enable = true;
  };

I haven’t tried this myself but maybe you need to add these CUDA libraries to programs.nix-ld.libraries nixpkgs/pkgs/development/python-modules/torch/bin/default.nix at daf6dc47aa4b44791372d6139ab7b25269184d55 · NixOS/nixpkgs · GitHub

I’m guessing they aren’t all needed but I’d start by just adding them and see if it works. If not maybe try strace -fe file uv run python main.py to see what file’s it’s accessing or looking for.