I do not run teensy_reboot directly, PlatformIO will call it. I tried something like this but still getting same error:
env LD_LIBRARY_PATH=$(nix path-info nixpkgs#libuv)/lib pio run -t upload $*
Is there any way to set LD_LIBRARY_PATH or nix-ld in configuration.nix file?
I added these line to configuration.nix but not sure if it is the correct way:
I don’t know the project in question but the platformio package has a platformio-chrootenv variant which runs inside of an FHSEnv. Have you tried that?
Rebooting...
these 2 paths will be fetched (6.29 MiB download, 28.97 MiB unpacked):
/nix/store/apab5i73dqa09wx0q27b6fbhd1r18ihl-glibc-2.39-31
/nix/store/adymciwshrcsm52xjdblsvrcwjqj6k5b-libuv-1.48.0
error: path '/nix/store/adymciwshrcsm52xjdblsvrcwjqj6k5b-libuv-1.48.0' is not valid
/home/USERNAME/.platformio/packages/tool-teensy/teensy_reboot.orig: error while loading shared libraries: libudev.so.1: cannot open shared object file: No such file or directory
*** [upload] Error 127
In that case it’s clear why nix-ld won’t do anything; its ldso is overwritten with the FHSenv’s ldso inside the FHSEnv.
The package sadly doesn’t offer a convenient way of doing that via an override. You’d have to edit the package’s chrootenv.nix to include udev. It’d be great if you could create a PR for that against Nixpkgs so that the package works as expected for all others attempting to do the same thing you are going forward.