How to add derivation's dependencies to PATH

So, I’ve created a Deno script. It basically just runs other tools as subprocesses. I’m trying to package it using mkDerivation.

To be able to run, the executables it needs need to be in the PATH. I’m not sure how to do it (buildInputs doesn’t seem to work).

I’m also not sure if I should do it at all. Is that within the scope of a derivation? Or should I maybe build a NixOS module instead?

1 Like

Speaking very broadly, we handle this one of a few ways:

  • generate a wrapper for the script (generally with makeWrapper) that sets an appropriate PATH with necessary runtime dependencies
  • inject a PATH directly into whatever it is we’re generating or packaging
  • inline explicit references to the dependencies by absolute path during the build process

makeWrapper is probably the simplest place to start, so I’d focus on that and fail into something else if there’s a compelling reason.

1 Like