Cannot connect to dylib when installing R package sf from binary on MacOS

Hi there,
I’m a relatively new nix user and I’ve been trying to get a system environment for R projects with nix and managing packages via renv. I’ve followed a workaround to get binary packages to install as this hugely improves environment build times. However, sf``, classInt, KernSmoothandRcpp` don’t connect to the right libraries. They try to find libraries on the standard R paths.

My current workaround is to install these packages from source but is there a way to make the dylib libraries “visible”?

Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/ravis/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/aarch64-apple-darwin23.6.0/KernSmooth/2.23-24/9f33a1ee37bbe8919eb2ec4b9f2473a5/KernSmooth/libs/KernSmooth.so':
  dlopen(/Users/ravis/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/aarch64-apple-darwin23.6.0/KernSmooth/2.23-24/9f33a1ee37bbe8919eb2ec4b9f2473a5/KernSmooth/libs/KernSmooth.so, 0x0006): Library not loaded: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.dylib
  Referenced from: <4E358024-A3F8-3F34-A17B-88E069FB63F5> /Users/ravis/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.4/aarch64-apple-darwin23.6.0/KernSmooth/2.23-24/9f33a1ee37bbe8919eb2ec4b9f2473a5/KernSmooth/libs/KernSmooth.so
  Reason: tried: '/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Framewor

System

Mac OS Sonona 14.6.1
R 4.4.1