Successful workaround on pip does not work on Nix

Hi, I’m running Nix on macOS version 11.3 (Apple Silicon).
Currently nix-shell -p python3.pkgs.scipy fails on Apple Silicon, as pip install scipy does.

There’s a workaround reported in the issue, which sets the following envvars before pip install:

brew install openblas
export OPENBLAS=$(brew --prefix openblas)
export CFLAGS="-falign-functions=8 ${CFLAGS}"
pip install scipy

I’m trying to apply this on scipy default.nix, and I added these lines:

{..., openblas };
buildPythonPackage rec {
  preConfigure = ''
    export OPENBLAS=${openblas}
    export CFLAGS="-falign-functions=8 $CFLAGS"

(full version)
But this gives me the same error as before (error details here).
I also tried replacing ${openblas} with ${numpy.blas}, but that didn’t work either.

Could anyone tell me if I am missing something to replicate the pip workaround?

scipy uses numpy.blas

and in numpy you can override blas as parameter

I’m not quite sure if I get it. Could you please elaborate a bit more?
Are you suggesting to replace blas with openblas in numpy default.nix?

I tried replacing ${openblas} with ${numpy.blas} in my default.nix (and it didn’t work), so I guess buildInputs is configured correctly in that case.