I have been working with Nix for a few weeks and I love it, but there are a couple of things I don’t understand.
I have a package for a C program that can spawn processes and run programs written in other languages.
Now, I integrated a Python script with a preamble, but the program aborted because it couldn’t find python3. Here’s the
error starting plugin '/nix/store/kqdyymv40kk0ml85ji5j3kxwnvk6348b-clightning-v23.08/libexec/c-lightning/plugins/clnrest/clnrest.py': opening pipe: No such file or directory
Why isn’t the Python file starting correctly? What’s the trick here?
I understand that Nix has its own environment and that the binary runs under a custom path. However, I feel I’m missing something. I’d be really grateful if someone could help me fix this issue and also help me understand what’s going on.
Generally speaking, shebangs for interpreted executables in a nix package should get rewritten with patchShebangs (it’ll replace something like /usr/bin/env python3 with an absolute path), but the clightning package doesn’t include this plugin in the list of files it patches:
So, narrowly, I guess there’s a packaging problem here that needs to get fixed in nixpkgs.
You could fix the narrow problem by adding it to the list of inputs to patchShebangs.
Unfortunately, fixing this alone isn’t enough to make this just work. If you look at the plugin upstream (https://github.com/ElementsProject/lightning/tree/master/plugins/clnrest), you’ll see that it has several additional Python dependencies that aren’t declared in clightning’s Nix expression.
I’m not sure if @jb55 or @prusnak will see this, but maybe they’ll have ideas on the best way to fix this plugin.