How can I run uvx?

I’m trying to follow a tutorial on MCP and it uses uvx.

It seems all of these MCP tutorials using this command;)

I get this

$ uvx pycowsay hello from uv
error: Querying Python at `/home/b0ef/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu/bin/python3.13` failed with exit status exit status: 127
--- stdout:

--- stderr:
Could not start dynamically linked executable: /home/b0ef/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu/bin/python3.13
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
---

I’ve tried to search a little, but what I find seems to solve other problems.

Hello

You just copy-pasted the link Frequently Asked Questions — nix.dev documentation to the solution: programs.nix-ld.enable = true; :slight_smile:

This seems more like a hack to run executables, but can’t something like uvx be packaged? I mean, it doesn’t seem like it wants to install something. It sort of downloads everything it needs before it runs something, to my understanding.

Exactly. But those things it downloads have a hardcoded path to a required dynamic linker at /lib64/ld-linux-x86-64.so.2.
They won’t work if this file is not there. And by default this file is not there on NixOS. So your choices are:

  1. add this file, so that the downloaded binaries work out of the box
  2. patch the downloaded binaries with paths to nix-store for all required libs
  3. don’t run the downloaded binaries at all

For this the solutions are

  1. programs.nix-ld.enable = true;
  2. good luck
  3. don’t use uvx for binaries

I don’t necessarily have to run that specific command.

For dealing with MCP in NixOS, maybe I’m supposed to be using a different command.