summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/applications/radio/gnss-sdr/default.nix8
-rw-r--r--pkgs/applications/science/biology/plink-ng/default.nix15
-rw-r--r--pkgs/applications/science/chemistry/octopus/default.nix10
-rw-r--r--pkgs/applications/science/chemistry/openmolcas/default.nix4
-rw-r--r--pkgs/applications/science/chemistry/quantum-espresso/default.nix4
-rw-r--r--pkgs/applications/science/chemistry/siesta/default.nix8
-rw-r--r--pkgs/applications/science/machine-learning/shogun/default.nix8
-rw-r--r--pkgs/applications/science/math/R/default.nix10
-rw-r--r--pkgs/applications/science/math/caffe/default.nix4
-rw-r--r--pkgs/applications/science/math/calculix/calculix.patch2
-rw-r--r--pkgs/applications/science/math/calculix/default.nix4
-rw-r--r--pkgs/applications/science/math/cntk/default.nix3
-rw-r--r--pkgs/applications/science/math/csdp/default.nix4
-rw-r--r--pkgs/applications/science/math/getdp/default.nix4
-rw-r--r--pkgs/applications/science/math/giac/default.nix6
-rw-r--r--pkgs/applications/science/math/gmsh/default.nix6
-rw-r--r--pkgs/applications/science/math/jags/default.nix6
-rw-r--r--pkgs/applications/science/math/mxnet/default.nix6
-rw-r--r--pkgs/applications/science/math/sage/sage-env.nix7
-rw-r--r--pkgs/applications/science/math/sage/sage-with-env.nix8
-rw-r--r--pkgs/applications/science/math/sage/sagelib.nix8
-rw-r--r--pkgs/applications/science/misc/openmodelica/default.nix8
-rw-r--r--pkgs/applications/science/molecular-dynamics/lammps/default.nix4
-rw-r--r--pkgs/applications/science/physics/xfitter/default.nix4
-rw-r--r--pkgs/development/compilers/halide/default.nix5
-rw-r--r--pkgs/development/compilers/julia/1.3.nix24
-rw-r--r--pkgs/development/compilers/julia/shared.nix20
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix7
-rw-r--r--pkgs/development/interpreters/octave/default.nix25
-rw-r--r--pkgs/development/libraries/armadillo/default.nix6
-rw-r--r--pkgs/development/libraries/arrayfire/default.nix22
-rw-r--r--pkgs/development/libraries/flint/default.nix4
-rw-r--r--pkgs/development/libraries/givaro/default.nix3
-rw-r--r--pkgs/development/libraries/globalarrays/default.nix8
-rw-r--r--pkgs/development/libraries/iml/default.nix6
-rw-r--r--pkgs/development/libraries/libcint/default.nix4
-rw-r--r--pkgs/development/libraries/opencv/3.x.nix4
-rw-r--r--pkgs/development/libraries/opencv/4.x.nix4
-rw-r--r--pkgs/development/libraries/qrupdate/default.nix11
-rw-r--r--pkgs/development/libraries/science/math/arpack/default.nix9
-rw-r--r--pkgs/development/libraries/science/math/cholmod-extra/default.nix15
-rw-r--r--pkgs/development/libraries/science/math/fenics/default.nix7
-rw-r--r--pkgs/development/libraries/science/math/ipopt/default.nix10
-rw-r--r--pkgs/development/libraries/science/math/magma/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/petsc/default.nix8
-rw-r--r--pkgs/development/libraries/science/math/scalapack/default.nix9
-rw-r--r--pkgs/development/libraries/science/math/scs/default.nix4
-rw-r--r--pkgs/development/libraries/science/math/suitesparse/4.2.nix10
-rw-r--r--pkgs/development/libraries/science/math/suitesparse/4.4.nix14
-rw-r--r--pkgs/development/libraries/science/math/suitesparse/default.nix10
-rw-r--r--pkgs/development/libraries/science/math/superlu/default.nix7
-rw-r--r--pkgs/development/libraries/science/math/superlu/find-openblas-library.patch11
-rw-r--r--pkgs/development/libraries/sundials/2.x.nix10
-rw-r--r--pkgs/development/libraries/sundials/default.nix11
-rw-r--r--pkgs/development/ocaml-modules/lacaml/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/owl/default.nix7
-rw-r--r--pkgs/development/python-modules/cvxopt/default.nix11
-rw-r--r--pkgs/development/python-modules/numpy/default.nix20
-rw-r--r--pkgs/development/python-modules/prox-tv/default.nix13
-rw-r--r--pkgs/development/python-modules/prox-tv/use-openblas.patch11
-rw-r--r--pkgs/development/python-modules/pysparse/default.nix7
-rw-r--r--pkgs/development/python-modules/scs/default.nix4
-rw-r--r--pkgs/development/r-modules/default.nix6
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix23
-rw-r--r--pkgs/servers/mail/rspamd/default.nix4
-rw-r--r--pkgs/tools/misc/hpl/default.nix7
-rw-r--r--pkgs/top-level/all-packages.nix12
-rw-r--r--pkgs/top-level/python-packages.nix10
68 files changed, 272 insertions, 311 deletions
diff --git a/pkgs/applications/radio/gnss-sdr/default.nix b/pkgs/applications/radio/gnss-sdr/default.nix
index 005f83e0f54..4e423094e90 100644
--- a/pkgs/applications/radio/gnss-sdr/default.nix
+++ b/pkgs/applications/radio/gnss-sdr/default.nix
@@ -12,7 +12,7 @@
 , pythonPackages
 , uhd
 , log4cpp
-, openblas
+, blas, lapack
 , matio
 , pugixml
 , protobuf
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
     # nothing to be gained by leaving it out.
     uhd
     log4cpp
-    openblas
+    blas lapack
     matio
     pugixml
     protobuf
@@ -63,8 +63,8 @@ stdenv.mkDerivation rec {
     # armadillo is built using both, so skip checking for them.
     "-DBLAS=YES"
     "-DLAPACK=YES"
-    "-DBLAS_LIBRARIES=-lopenblas"
-    "-DLAPACK_LIBRARIES=-lopenblas"
+    "-DBLAS_LIBRARIES=-lblas"
+    "-DLAPACK_LIBRARIES=-llapack"
 
     # Similarly, it doesn't actually use gfortran despite checking for
     # its presence.
diff --git a/pkgs/applications/science/biology/plink-ng/default.nix b/pkgs/applications/science/biology/plink-ng/default.nix
index 13f00c53fe6..0a31ff6ba4f 100644
--- a/pkgs/applications/science/biology/plink-ng/default.nix
+++ b/pkgs/applications/science/biology/plink-ng/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, zlib, openblas, darwin}:
+{ stdenv, fetchFromGitHub, zlib, blas, lapack, darwin}:
 
 stdenv.mkDerivation rec {
   pname = "plink-ng";
@@ -11,14 +11,20 @@ stdenv.mkDerivation rec {
     sha256 = "1zhffjbwpd50dxywccbnv1rxy9njwz73l4awc5j7i28rgj3davcq";
   };
 
-  buildInputs = [ zlib ] ++ (if stdenv.isDarwin then [ darwin.apple_sdk.frameworks.Accelerate ] else [ openblas ]) ;
+  buildInputs = [ zlib ] ++ (if stdenv.isDarwin then [ darwin.apple_sdk.frameworks.Accelerate ] else [ blas lapack ]) ;
 
-  buildPhase = ''
+  preBuild = ''
     sed -i 's|zlib-1.2.8/zlib.h|zlib.h|g' *.c *.h
     ${if stdenv.cc.isClang then "sed -i 's|g++|clang++|g' Makefile.std" else ""}
-    make ZLIB=-lz ${if stdenv.isDarwin then "" else "BLASFLAGS=-lopenblas"} -f Makefile.std
+
+    makeFlagsArray+=(
+      ZLIB=-lz
+      BLASFLAGS="-lblas -lcblas -llapack"
+    );
   '';
 
+  makefile = "Makefile.std";
+
   installPhase = ''
     mkdir -p $out/bin
     cp plink $out/bin
@@ -31,4 +37,3 @@ stdenv.mkDerivation rec {
     platforms = stdenv.lib.platforms.linux;
   };
 }
-
diff --git a/pkgs/applications/science/chemistry/octopus/default.nix b/pkgs/applications/science/chemistry/octopus/default.nix
index f8ce3e925fd..f30954367cf 100644
--- a/pkgs/applications/science/chemistry/octopus/default.nix
+++ b/pkgs/applications/science/chemistry/octopus/default.nix
@@ -1,7 +1,9 @@
 { stdenv, fetchFromGitLab, symlinkJoin, gfortran, perl, procps
-, libyaml, libxc, fftw, openblas, gsl, netcdf, arpack, autoreconfHook
+, libyaml, libxc, fftw, blas, lapack, gsl, netcdf, arpack, autoreconfHook
 }:
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 stdenv.mkDerivation rec {
   pname = "octopus";
   version = "9.2";
@@ -14,12 +16,12 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ perl procps autoreconfHook ];
-  buildInputs = [ libyaml gfortran libxc openblas gsl fftw netcdf arpack ];
+  buildInputs = [ libyaml gfortran libxc blas lapack gsl fftw netcdf arpack ];
 
   configureFlags = [
     "--with-yaml-prefix=${libyaml}"
-    "--with-blas=-lopenblas"
-    "--with-lapack=-lopenblas"
+    "--with-blas=-lblas"
+    "--with-lapack=-llapack"
     "--with-fftw-prefix=${fftw.dev}"
     "--with-gsl-prefix=${gsl}"
     "--with-libxc-prefix=${libxc}"
diff --git a/pkgs/applications/science/chemistry/openmolcas/default.nix b/pkgs/applications/science/chemistry/openmolcas/default.nix
index b1720e105fd..0d74e784d77 100644
--- a/pkgs/applications/science/chemistry/openmolcas/default.nix
+++ b/pkgs/applications/science/chemistry/openmolcas/default.nix
@@ -1,9 +1,11 @@
 { stdenv, fetchFromGitLab, cmake, gfortran, perl
-, openblas, hdf5-cpp, python3, texlive
+, openblas, blas, lapack, hdf5-cpp, python3, texlive
 , armadillo, openmpi, globalarrays, openssh
 , makeWrapper, fetchpatch
 } :
 
+assert blas.implementation == "openblas" && lapack.implementation == "openblas";
+
 let
   version = "19.11";
   gitLabRev = "v${version}";
diff --git a/pkgs/applications/science/chemistry/quantum-espresso/default.nix b/pkgs/applications/science/chemistry/quantum-espresso/default.nix
index bd420519ce0..2443e6b23ab 100644
--- a/pkgs/applications/science/chemistry/quantum-espresso/default.nix
+++ b/pkgs/applications/science/chemistry/quantum-espresso/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl
-, gfortran, fftw, openblas
+, gfortran, fftw, blas, lapack
 , mpi ? null
 }:
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     patchShebangs configure
   '';
 
-  buildInputs = [ fftw openblas gfortran ]
+  buildInputs = [ fftw blas lapack gfortran ]
     ++ (stdenv.lib.optionals (mpi != null) [ mpi ]);
 
 configureFlags = if (mpi != null) then [ "LD=${mpi}/bin/mpif90" ] else [ "LD=${gfortran}/bin/gfortran" ];
diff --git a/pkgs/applications/science/chemistry/siesta/default.nix b/pkgs/applications/science/chemistry/siesta/default.nix
index 11f3e551431..c053c0a09cd 100644
--- a/pkgs/applications/science/chemistry/siesta/default.nix
+++ b/pkgs/applications/science/chemistry/siesta/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl
-, gfortran, openblas
+, gfortran, blas, lapack
 , mpi ? null, scalapack
 }:
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
     inherit mpi;
   };
 
-  buildInputs = [ openblas gfortran ]
+  buildInputs = [ blas lapack gfortran ]
     ++ (stdenv.lib.optionals (mpi != null) [ mpi scalapack ]);
 
   enableParallelBuilding = true;
@@ -33,11 +33,11 @@ stdenv.mkDerivation {
     makeFlagsArray=(
         CC="mpicc" FC="mpifort"
         FPPFLAGS="-DMPI" MPI_INTERFACE="libmpi_f90.a" MPI_INCLUDE="."
-        COMP_LIBS="" LIBS="-lopenblas -lscalapack"
+        COMP_LIBS="" LIBS="-lblas -llapack -lscalapack"
     );
   '' else ''
     makeFlagsArray=(
-      COMP_LIBS="" LIBS="-lopenblas"
+      COMP_LIBS="" LIBS="-lblas -llapack"
     );
   '';
 
diff --git a/pkgs/applications/science/machine-learning/shogun/default.nix b/pkgs/applications/science/machine-learning/shogun/default.nix
index 988ea8c855c..33871df87f3 100644
--- a/pkgs/applications/science/machine-learning/shogun/default.nix
+++ b/pkgs/applications/science/machine-learning/shogun/default.nix
@@ -2,7 +2,7 @@
 # data, compression
 , bzip2, curl, hdf5, json_c, lzma, lzo, protobuf, snappy
 # maths
-, openblasCompat, eigen, nlopt, lp_solve, colpack, liblapack, glpk
+, blas, lapack, eigen, nlopt, lp_solve, colpack, glpk
 # libraries
 , libarchive, libxml2
 # extra support
@@ -13,6 +13,8 @@
 assert pythonSupport -> pythonPackages != null;
 assert opencvSupport -> opencv != null;
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 let
   pname = "shogun";
   version = "6.1.4";
@@ -64,8 +66,8 @@ stdenv.mkDerivation rec {
   CCACHE_DIR=".ccache";
 
   buildInputs = with lib; [
-      openblasCompat bzip2 cmake colpack curl ctags eigen hdf5 json_c lp_solve lzma lzo
-      protobuf nlopt snappy swig (libarchive.dev) libxml2 liblapack glpk
+      blas lapack bzip2 cmake colpack curl ctags eigen hdf5 json_c lp_solve lzma lzo
+      protobuf nlopt snappy swig (libarchive.dev) libxml2 lapack glpk
     ]
     ++ optionals (pythonSupport) (with pythonPackages; [ python ply numpy ])
     ++ optional  (opencvSupport) opencv;
diff --git a/pkgs/applications/science/math/R/default.nix b/pkgs/applications/science/math/R/default.nix
index 3ee62fad44d..836ce004fff 100644
--- a/pkgs/applications/science/math/R/default.nix
+++ b/pkgs/applications/science/math/R/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt, libjpeg, libpng
 , libtiff, ncurses, pango, pcre, perl, readline, tcl, texLive, tk, xz, zlib
-, less, texinfo, graphviz, icu, pkgconfig, bison, imake, which, jdk, openblas
+, less, texinfo, graphviz, icu, pkgconfig, bison, imake, which, jdk, blas, lapack
 , curl, Cocoa, Foundation, libobjc, libcxx, tzdata, fetchpatch
 , withRecommendedPackages ? true
 , enableStrictBarrier ? false
@@ -9,6 +9,8 @@
 , static ? false
 }:
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 stdenv.mkDerivation rec {
   name = "R-3.6.3";
 
@@ -22,7 +24,7 @@ stdenv.mkDerivation rec {
   buildInputs = [
     bzip2 gfortran libX11 libXmu libXt libXt libjpeg libpng libtiff ncurses
     pango pcre perl readline texLive xz zlib less texinfo graphviz icu
-    pkgconfig bison imake which openblas curl tcl tk jdk
+    pkgconfig bison imake which blas lapack curl tcl tk jdk
   ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation libobjc libcxx ];
 
   patches = [
@@ -43,8 +45,8 @@ stdenv.mkDerivation rec {
     configureFlagsArray=(
       --disable-lto
       --with${stdenv.lib.optionalString (!withRecommendedPackages) "out"}-recommended-packages
-      --with-blas="-L${openblas}/lib -lopenblas"
-      --with-lapack="-L${openblas}/lib -lopenblas"
+      --with-blas="-L${blas}/lib -lblas"
+      --with-lapack="-L${lapack}/lib -llapack"
       --with-readline
       --with-tcltk --with-tcl-config="${tcl}/lib/tclConfig.sh" --with-tk-config="${tk}/lib/tkConfig.sh"
       --with-cairo
diff --git a/pkgs/applications/science/math/caffe/default.nix b/pkgs/applications/science/math/caffe/default.nix
index ea87c4953ee..4a6a2dc6c7e 100644
--- a/pkgs/applications/science/math/caffe/default.nix
+++ b/pkgs/applications/science/math/caffe/default.nix
@@ -9,7 +9,7 @@
 , opencv3
 , protobuf
 , doxygen
-, openblas
+, blas
 , Accelerate, CoreGraphics, CoreVideo
 , lmdbSupport ? true, lmdb
 , leveldbSupport ? true, leveldb, snappy
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
       ++ ["-DUSE_LEVELDB=${toggle leveldbSupport}"]
       ++ ["-DUSE_LMDB=${toggle lmdbSupport}"];
 
-  buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv3 openblas ]
+  buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv3 blas ]
                 ++ lib.optional cudaSupport cudatoolkit
                 ++ lib.optional cudnnSupport cudnn
                 ++ lib.optional lmdbSupport lmdb
diff --git a/pkgs/applications/science/math/calculix/calculix.patch b/pkgs/applications/science/math/calculix/calculix.patch
index 311421f2ef5..5b8f492a8e7 100644
--- a/pkgs/applications/science/math/calculix/calculix.patch
+++ b/pkgs/applications/science/math/calculix/calculix.patch
@@ -15,7 +15,7 @@ index 9cab2fc..6e977b8 100755
  OCCXMAIN = $(SCCXMAIN:.c=.o)
  
 -DIR=../../../SPOOLES.2.2
-+LIBS = -lpthread -lm -lc -lspooles -larpack -lopenblas
++LIBS = -lpthread -lm -lc -lspooles -larpack -lblas -llapack
  
 -LIBS = \
 -       $(DIR)/spooles.a \
diff --git a/pkgs/applications/science/math/calculix/default.nix b/pkgs/applications/science/math/calculix/default.nix
index 6f2d61cd80f..44882594550 100644
--- a/pkgs/applications/science/math/calculix/default.nix
+++ b/pkgs/applications/science/math/calculix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, arpack, spooles, openblas }:
+{ stdenv, fetchurl, gfortran, arpack, spooles, blas, lapack }:
 
 stdenv.mkDerivation rec {
   pname = "calculix";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ gfortran ];
 
-  buildInputs = [ arpack spooles openblas ];
+  buildInputs = [ arpack spooles blas lapack ];
 
   NIX_CFLAGS_COMPILE = "-I${spooles}/include/spooles";
 
diff --git a/pkgs/applications/science/math/cntk/default.nix b/pkgs/applications/science/math/cntk/default.nix
index e2db40a402e..401454a6b69 100644
--- a/pkgs/applications/science/math/cntk/default.nix
+++ b/pkgs/applications/science/math/cntk/default.nix
@@ -1,11 +1,12 @@
 { lib, stdenv, fetchgit, fetchFromGitHub, cmake
-, openblas, opencv3, libzip, boost, protobuf, openmpi
+, openblas, blas, lapack, opencv3, libzip, boost, protobuf, openmpi
 , onebitSGDSupport ? false
 , cudaSupport ? false, addOpenGLRunpath, cudatoolkit, nvidia_x11
 , cudnnSupport ? cudaSupport, cudnn
 }:
 
 assert cudnnSupport -> cudaSupport;
+assert blas.implementation == "openblas" && lapack.implementation == "openblas";
 
 let
   # Old specific version required for CNTK.
diff --git a/pkgs/applications/science/math/csdp/default.nix b/pkgs/applications/science/math/csdp/default.nix
index eef60829f8e..ef9d5e733ca 100644
--- a/pkgs/applications/science/math/csdp/default.nix
+++ b/pkgs/applications/science/math/csdp/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, blas, gfortran, liblapack }:
+{ lib, stdenv, fetchurl, blas, gfortran, lapack }:
 
 stdenv.mkDerivation {
   name = "csdp-6.1.1";
@@ -8,7 +8,7 @@ stdenv.mkDerivation {
     sha256 = "1f9ql6cjy2gwiyc51ylfan24v1ca9sjajxkbhszlds1lqmma8n05";
   };
 
-  buildInputs = [ blas gfortran.cc.lib liblapack ];
+  buildInputs = [ blas gfortran.cc.lib lapack ];
 
   postPatch = ''
     substituteInPlace Makefile --replace /usr/local/bin $out/bin
diff --git a/pkgs/applications/science/math/getdp/default.nix b/pkgs/applications/science/math/getdp/default.nix
index 0ac2ea7d1b3..ae93e89f141 100644
--- a/pkgs/applications/science/math/getdp/default.nix
+++ b/pkgs/applications/science/math/getdp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, gfortran, openblas, openmpi, petsc, python3 }:
+{ stdenv, fetchurl, cmake, gfortran, blas, lapack, openmpi, petsc, python3 }:
 
 stdenv.mkDerivation rec {
   name = "getdp-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake gfortran ];
-  buildInputs = [ openblas openmpi petsc python3 ];
+  buildInputs = [ blas lapack openmpi petsc python3 ];
 
   meta = with stdenv.lib; {
     description = "A General Environment for the Treatment of Discrete Problems";
diff --git a/pkgs/applications/science/math/giac/default.nix b/pkgs/applications/science/math/giac/default.nix
index b3777528ecd..feb30b990ab 100644
--- a/pkgs/applications/science/math/giac/default.nix
+++ b/pkgs/applications/science/math/giac/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, lib, fetchurl, fetchpatch, texlive, bison, flex, liblapack
-, gmp, mpfr, pari, ntl, gsl, blas, mpfi, ecm, glpk, nauty
+{ stdenv, lib, fetchurl, fetchpatch, texlive, bison, flex, lapack, blas
+, gmp, mpfr, pari, ntl, gsl, mpfi, ecm, glpk, nauty
 , readline, gettext, libpng, libao, gfortran, perl
 , enableGUI ? false, libGL ? null, libGLU ? null, xorg ? null, fltk ? null
 }:
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
     # gfortran.cc default output contains static libraries compiled without -fPIC
     # we want libgfortran.so.3 instead
     (stdenv.lib.getLib gfortran.cc)
-    liblapack
+    lapack blas
   ] ++ stdenv.lib.optionals enableGUI [
     libGL libGLU fltk xorg.libX11
   ];
diff --git a/pkgs/applications/science/math/gmsh/default.nix b/pkgs/applications/science/math/gmsh/default.nix
index 2c4d5f254da..8ece2e7819c 100644
--- a/pkgs/applications/science/math/gmsh/default.nix
+++ b/pkgs/applications/science/math/gmsh/default.nix
@@ -1,6 +1,8 @@
-{ stdenv, fetchurl, cmake, openblasCompat, gfortran, gmm, fltk, libjpeg
+{ stdenv, fetchurl, cmake, blas, lapack, gfortran, gmm, fltk, libjpeg
 , zlib, libGL, libGLU, xorg, opencascade-occt }:
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 stdenv.mkDerivation rec {
   pname = "gmsh";
   version = "4.5.6";
@@ -10,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "0gs65bgr1ph5lz7r6manqj8cra30s7c94pxilkd2z0p5vq6fpsj6";
   };
 
-  buildInputs = [ openblasCompat gmm fltk libjpeg zlib libGLU libGL
+  buildInputs = [ blas lapack gmm fltk libjpeg zlib libGLU libGL
     libGLU xorg.libXrender xorg.libXcursor xorg.libXfixes xorg.libXext
     xorg.libXft xorg.libXinerama xorg.libX11 xorg.libSM xorg.libICE
     opencascade-occt
diff --git a/pkgs/applications/science/math/jags/default.nix b/pkgs/applications/science/math/jags/default.nix
index 5ac1594e19a..122c6288847 100644
--- a/pkgs/applications/science/math/jags/default.nix
+++ b/pkgs/applications/science/math/jags/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, gfortran, openblas}:
+{stdenv, fetchurl, gfortran, blas, lapack}:
 
 stdenv.mkDerivation rec {
   name = "JAGS-4.3.0";
@@ -6,8 +6,8 @@ stdenv.mkDerivation rec {
     url = "mirror://sourceforge/mcmc-jags/${name}.tar.gz";
     sha256 = "1z3icccg2ic56vmhyrpinlsvpq7kcaflk1731rgpvz9bk1bxvica";
   };
-  buildInputs = [gfortran openblas];
-  configureFlags = [ "--with-blas=-lopenblas" "--with-lapack=-lopenblas" ];
+  buildInputs = [gfortran blas lapack];
+  configureFlags = [ "--with-blas=-lblas" "--with-lapack=-llapack" ];
 
   meta = with stdenv.lib; {
     description = "Just Another Gibbs Sampler";
diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix
index 5b7688f6051..87d46850f14 100644
--- a/pkgs/applications/science/math/mxnet/default.nix
+++ b/pkgs/applications/science/math/mxnet/default.nix
@@ -1,5 +1,5 @@
 { config, stdenv, lib, fetchurl, bash, cmake
-, opencv3, gtest, openblas, liblapack, perl
+, opencv3, gtest, blas, perl
 , cudaSupport ? config.cudaSupport or false, cudatoolkit, nvidia_x11
 , cudnnSupport ? cudaSupport, cudnn
 }:
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake perl ];
 
-  buildInputs = [ opencv3 gtest openblas liblapack ]
+  buildInputs = [ opencv3 gtest blas ]
               ++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ]
               ++ lib.optional cudnnSupport cudnn;
 
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     substituteInPlace 3rdparty/mkldnn/tests/CMakeLists.txt \
       --replace "/bin/bash" "${bash}/bin/bash"
 
-    # Build against the system version of OpenMP. 
+    # Build against the system version of OpenMP.
     # https://github.com/apache/incubator-mxnet/pull/12160
     rm -rf 3rdparty/openmp
   '';
diff --git a/pkgs/applications/science/math/sage/sage-env.nix b/pkgs/applications/science/math/sage/sage-env.nix
index 68e0d134ace..c0dfeef1119 100644
--- a/pkgs/applications/science/math/sage/sage-env.nix
+++ b/pkgs/applications/science/math/sage/sage-env.nix
@@ -41,7 +41,8 @@
 , lcalc
 , rubiks
 , flintqs
-, openblasCompat
+, blas
+, lapack
 , flint
 , gmp
 , mpfr
@@ -53,6 +54,8 @@
 , less
 }:
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 # This generates a `sage-env` shell file that will be sourced by sage on startup.
 # It sets up various environment variables, telling sage where to find its
 # dependencies.
@@ -114,7 +117,7 @@ writeTextFile rec {
         # testsuite instead, but since all the packages are also runtime
         # dependencies it doesn't really hurt to include them here.
         singular
-        openblasCompat
+        blas lapack
         fflas-ffpack givaro
         gd
         libpng zlib
diff --git a/pkgs/applications/science/math/sage/sage-with-env.nix b/pkgs/applications/science/math/sage/sage-with-env.nix
index 524085e8c01..77bc65c2be1 100644
--- a/pkgs/applications/science/math/sage/sage-with-env.nix
+++ b/pkgs/applications/science/math/sage/sage-with-env.nix
@@ -2,7 +2,8 @@
 , lib
 , makeWrapper
 , sage-env
-, openblasCompat
+, blas
+, lapack
 , pkg-config
 , three
 , singular
@@ -21,6 +22,9 @@
 , pythonEnv
 }:
 
+# lots of segfaults with (64 bit) blas
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 # Wrapper that combined `sagelib` with `sage-env` to produce an actually
 # executable sage. No tests are run yet and no documentation is built.
 
@@ -29,7 +33,7 @@ let
     pythonEnv # for patchShebangs
     makeWrapper
     pkg-config
-    openblasCompat # lots of segfaults with regular (64 bit) openblas
+    blas lapack
     singular
     three
     pynac
diff --git a/pkgs/applications/science/math/sage/sagelib.nix b/pkgs/applications/science/math/sage/sagelib.nix
index 69f7624078e..92b4e8efa2e 100644
--- a/pkgs/applications/science/math/sage/sagelib.nix
+++ b/pkgs/applications/science/math/sage/sagelib.nix
@@ -3,7 +3,8 @@
 , perl
 , buildPythonPackage
 , arb
-, openblasCompat
+, blas
+, lapack
 , brial
 , cliquer
 , cypari2
@@ -52,6 +53,8 @@
 , pplpy
 }:
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 # This is the core sage python package. Everything else is just wrappers gluing
 # stuff together. It is not very useful on its own though, since it will not
 # find many of its dependencies without `sage-env`, will not be tested without
@@ -103,7 +106,8 @@ buildPythonPackage rec {
     m4rie
     mpfi
     ntl
-    openblasCompat
+    blas
+    lapack
     pari
     planarity
     ppl
diff --git a/pkgs/applications/science/misc/openmodelica/default.nix b/pkgs/applications/science/misc/openmodelica/default.nix
index ed4101bdb47..50d4dcc1a9f 100644
--- a/pkgs/applications/science/misc/openmodelica/default.nix
+++ b/pkgs/applications/science/misc/openmodelica/default.nix
@@ -1,5 +1,5 @@
 {stdenv, fetchgit, fetchsvn, autoconf, automake, libtool, gfortran, clang, cmake, gnumake,
-hwloc, jre, liblapack, blas, hdf5, expat, ncurses, readline, qt4, webkitgtk, which,
+hwloc, jre, lapack, blas, hdf5, expat, ncurses, readline, qt4, webkitgtk, which,
 lp_solve, omniorb, sqlite, libatomic_ops, pkgconfig, file, gettext, flex, bison,
 doxygen, boost, openscenegraph, gnome2, xorg, git, bash, gtk2, makeWrapper }:
 
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
   src = fetchgit (import ./src-main.nix);
 
   buildInputs = [autoconf cmake automake libtool gfortran clang gnumake
-    hwloc jre liblapack blas hdf5 expat ncurses readline qt4 webkitgtk which
+    hwloc jre lapack blas hdf5 expat ncurses readline qt4 webkitgtk which
     lp_solve omniorb sqlite libatomic_ops pkgconfig file gettext flex bison
     doxygen boost openscenegraph gnome2.gtkglext xorg.libXmu
     git gtk2 makeWrapper];
@@ -40,7 +40,7 @@ stdenv.mkDerivation {
     for e in $(cd $out/bin && ls); do
       wrapProgram $out/bin/$e \
         --prefix PATH : "${gnumake}/bin" \
-        --prefix LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ liblapack blas ]}"
+        --prefix LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ lapack blas ]}"
     done
   '';
 
@@ -53,5 +53,3 @@ stdenv.mkDerivation {
     broken      = true;
   };
 }
-
-
diff --git a/pkgs/applications/science/molecular-dynamics/lammps/default.nix b/pkgs/applications/science/molecular-dynamics/lammps/default.nix
index ab706a88931..5dc31695c60 100644
--- a/pkgs/applications/science/molecular-dynamics/lammps/default.nix
+++ b/pkgs/applications/science/molecular-dynamics/lammps/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub
-, libpng, gzip, fftw, openblas
+, libpng, gzip, fftw, blas, lapack
 , mpi ? null
 }:
 let packages = [
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     inherit packages;
   };
 
-  buildInputs = [ fftw libpng openblas gzip ]
+  buildInputs = [ fftw libpng blas lapack gzip ]
     ++ (stdenv.lib.optionals withMPI [ mpi ]);
 
   configurePhase = ''
diff --git a/pkgs/applications/science/physics/xfitter/default.nix b/pkgs/applications/science/physics/xfitter/default.nix
index f4d70e79079..b992851e40a 100644
--- a/pkgs/applications/science/physics/xfitter/default.nix
+++ b/pkgs/applications/science/physics/xfitter/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, apfel, apfelgrid, applgrid, blas, gfortran, lhapdf, liblapack, libyaml, lynx, mela, root5, qcdnum, which }:
+{ stdenv, fetchurl, apfel, apfelgrid, applgrid, blas, gfortran, lhapdf, lapack, libyaml, lynx, mela, root5, qcdnum, which }:
 
 stdenv.mkDerivation rec {
   pname = "xfitter";
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ gfortran which ];
   buildInputs =
-    [ apfel apfelgrid applgrid blas lhapdf liblapack mela root5 qcdnum ]
+    [ apfel apfelgrid applgrid blas lhapdf lapack mela root5 qcdnum ]
     # pdf2yaml requires fmemopen and open_memstream which are not readily available on Darwin
     ++ stdenv.lib.optional (!stdenv.isDarwin) libyaml
     ;
diff --git a/pkgs/development/compilers/halide/default.nix b/pkgs/development/compilers/halide/default.nix
index 44c079af926..356ebe23172 100644
--- a/pkgs/development/compilers/halide/default.nix
+++ b/pkgs/development/compilers/halide/default.nix
@@ -1,7 +1,10 @@
 { llvmPackages, lib, fetchFromGitHub, cmake
-, libpng, libjpeg, mesa, eigen, openblas
+, libpng, libjpeg, mesa, eigen
+, openblas, blas, lapack
 }:
 
+assert blas.implementation == "openblas" && lapack.implementation == "openblas";
+
 let
   version = "2019_08_27";
 
diff --git a/pkgs/development/compilers/julia/1.3.nix b/pkgs/development/compilers/julia/1.3.nix
index 48034920e28..49dc17a27f4 100644
--- a/pkgs/development/compilers/julia/1.3.nix
+++ b/pkgs/development/compilers/julia/1.3.nix
@@ -7,28 +7,22 @@
 # standard library dependencies
 , curl, fftwSinglePrec, fftw, gmp, libgit2, mpfr, openlibm, openspecfun, pcre2
 # linear algebra
-, openblas, arpack
+, blas, lapack, arpack
 # Darwin frameworks
 , CoreServices, ApplicationServices
 }:
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 with stdenv.lib;
 
-# All dependencies must use the same OpenBLAS.
-let
-  arpack_ = arpack;
-in
 let
-  arpack = arpack_.override { inherit openblas; };
-in
-
-let 
   majorVersion = "1";
   minorVersion = "3";
   maintenanceVersion = "1";
   src_sha256 = "0q9a7yc3b235psrwl5ghyxgwly25lf8n818l8h6bkf2ymdbsv5p6";
   version = "${majorVersion}.${minorVersion}.${maintenanceVersion}";
-in 
+in
 
 stdenv.mkDerivation rec {
   pname = "julia";
@@ -67,7 +61,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     arpack fftw fftwSinglePrec gmp libgit2 libunwind mpfr
-    pcre2.dev openblas openlibm openspecfun readline utf8proc
+    pcre2.dev blas lapack openlibm openspecfun readline utf8proc
     zlib
   ]
   ++ stdenv.lib.optionals stdenv.isDarwin [CoreServices ApplicationServices]
@@ -94,13 +88,9 @@ stdenv.mkDerivation rec {
       "SHELL=${stdenv.shell}"
 
       "USE_SYSTEM_BLAS=1"
-      "USE_BLAS64=${if openblas.blas64 then "1" else "0"}"
-      "LIBBLAS=-lopenblas"
-      "LIBBLASNAME=libopenblas"
+      "USE_BLAS64=${if blas.is64bit then "1" else "0"}"
 
       "USE_SYSTEM_LAPACK=1"
-      "LIBLAPACK=-lopenblas"
-      "LIBLAPACKNAME=libopenblas"
 
       "USE_SYSTEM_ARPACK=1"
       "USE_SYSTEM_FFTW=1"
@@ -123,7 +113,7 @@ stdenv.mkDerivation rec {
     ];
 
   LD_LIBRARY_PATH = makeLibraryPath [
-    arpack fftw fftwSinglePrec gmp libgit2 mpfr openblas openlibm
+    arpack fftw fftwSinglePrec gmp libgit2 mpfr blas openlibm
     openspecfun pcre2
   ];
 
diff --git a/pkgs/development/compilers/julia/shared.nix b/pkgs/development/compilers/julia/shared.nix
index ec1818f9989..92e3d4a5c14 100644
--- a/pkgs/development/compilers/julia/shared.nix
+++ b/pkgs/development/compilers/julia/shared.nix
@@ -15,20 +15,14 @@
 # standard library dependencies
 , curl, fftwSinglePrec, fftw, gmp, libgit2, mpfr, openlibm, openspecfun, pcre2
 # linear algebra
-, openblas, arpack
+, blas, lapack, arpack
 # Darwin frameworks
 , CoreServices, ApplicationServices
 }:
 
 with stdenv.lib;
 
-# All dependencies must use the same OpenBLAS.
-let
-  arpack_ = arpack;
-in
-let
-  arpack = arpack_.override { inherit openblas; };
-in
+assert (!blas.is64bit) && (!lapack.is64bit);
 
 let
   dsfmtVersion = "2.2.3";
@@ -118,7 +112,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     arpack fftw fftwSinglePrec gmp libgit2 libunwind mpfr
-    pcre2.dev openblas openlibm openspecfun readline utf8proc
+    pcre2.dev blas lapack openlibm openspecfun readline utf8proc
     zlib
   ]
   ++ stdenv.lib.optionals stdenv.isDarwin [CoreServices ApplicationServices]
@@ -143,13 +137,9 @@ stdenv.mkDerivation rec {
       "SHELL=${stdenv.shell}"
 
       "USE_SYSTEM_BLAS=1"
-      "USE_BLAS64=${if openblas.blas64 then "1" else "0"}"
-      "LIBBLAS=-lopenblas"
-      "LIBBLASNAME=libopenblas"
+      "USE_BLAS64=${if blas.is64bit then "1" else "0"}"
 
       "USE_SYSTEM_LAPACK=1"
-      "LIBLAPACK=-lopenblas"
-      "LIBLAPACKNAME=libopenblas"
 
       "USE_SYSTEM_ARPACK=1"
       "USE_SYSTEM_FFTW=1"
@@ -173,7 +163,7 @@ stdenv.mkDerivation rec {
     ];
 
   LD_LIBRARY_PATH = makeLibraryPath [
-    arpack fftw fftwSinglePrec gmp libgit2 mpfr openblas openlibm
+    arpack fftw fftwSinglePrec gmp libgit2 mpfr blas lapack openlibm
     openspecfun pcre2
   ];
 
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index 29fcd5c7167..4cf9770c7a2 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -114,13 +114,8 @@ self: super: {
   # Depends on broken "hails" package.
   hails-bin = dontDistribute super.hails-bin;
 
-  # Switch levmar build to openblas.
   bindings-levmar = overrideCabal super.bindings-levmar (drv: {
-    preConfigure = ''
-      sed -i bindings-levmar.cabal \
-          -e 's,extra-libraries: lapack blas,extra-libraries: openblas,'
-    '';
-    extraLibraries = [ pkgs.openblasCompat ];
+    extraLibraries = [ pkgs.blas ];
   });
 
   # The Haddock phase fails for one reason or another.
diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix
index 4a63d186201..4d2bf40b329 100644
--- a/pkgs/development/interpreters/octave/default.nix
+++ b/pkgs/development/interpreters/octave/default.nix
@@ -21,7 +21,7 @@
 , zlib
 , curl
 , qrupdate
-, openblas
+, blas, lapack
 , arpack
 , libwebp
 , gl2ps
@@ -53,17 +53,7 @@
 , darwin
 }:
 
-let
-  suitesparseOrig = suitesparse;
-  qrupdateOrig = qrupdate;
-in
-# integer width is determined by openblas, so all dependencies must be built
-# with exactly the same openblas
-let
-  suitesparse =
-    if suitesparseOrig != null then suitesparseOrig.override { inherit openblas; } else null;
-  qrupdate = if qrupdateOrig != null then qrupdateOrig.override { inherit openblas; } else null;
-in
+assert (!blas.is64bit) && (!lapack.is64bit);
 
 stdenv.mkDerivation rec {
   version = "5.2.0";
@@ -85,7 +75,8 @@ stdenv.mkDerivation rec {
     fltk
     zlib
     curl
-    openblas
+    blas
+    lapack
     libsndfile
     fftw
     fftwSinglePrec
@@ -134,15 +125,15 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   # See https://savannah.gnu.org/bugs/?50339
-  F77_INTEGER_8_FLAG = if openblas.blas64 then "-fdefault-integer-8" else "";
+  F77_INTEGER_8_FLAG = if blas.is64bit then "-fdefault-integer-8" else "";
 
   configureFlags = [
-    "--with-blas=openblas"
-    "--with-lapack=openblas"
+    "--with-blas=blas"
+    "--with-lapack=lapack"
+    (if blas.is64bit then "--enable-64" else "--disable-64")
   ]
     ++ (if stdenv.isDarwin then [ "--enable-link-all-dependencies" ] else [ ])
     ++ stdenv.lib.optionals enableReadline [ "--enable-readline" ]
-    ++ stdenv.lib.optionals openblas.blas64 [ "--enable-64" ]
     ++ stdenv.lib.optionals stdenv.isDarwin [ "--with-x=no" ]
     ++ stdenv.lib.optionals enableQt [ "--with-qt=5" ]
     ++ stdenv.lib.optionals enableJIT [ "--enable-jit" ]
diff --git a/pkgs/development/libraries/armadillo/default.nix b/pkgs/development/libraries/armadillo/default.nix
index f6710d4fc57..3251b1c9e0d 100644
--- a/pkgs/development/libraries/armadillo/default.nix
+++ b/pkgs/development/libraries/armadillo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, openblasCompat, superlu, hdf5 }:
+{ stdenv, fetchurl, cmake, blas, lapack, superlu, hdf5 }:
 
 stdenv.mkDerivation rec {
   pname = "armadillo";
@@ -10,10 +10,10 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake ];
-  buildInputs = [ openblasCompat superlu hdf5 ];
+  buildInputs = [ blas lapack superlu hdf5 ];
 
   cmakeFlags = [
-    "-DLAPACK_LIBRARY=${openblasCompat}/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary}"
+    "-DLAPACK_LIBRARY=${lapack}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}"
     "-DDETECT_HDF5=ON"
   ];
 
diff --git a/pkgs/development/libraries/arrayfire/default.nix b/pkgs/development/libraries/arrayfire/default.nix
index 21e93a8cd49..e637aab48b2 100644
--- a/pkgs/development/libraries/arrayfire/default.nix
+++ b/pkgs/development/libraries/arrayfire/default.nix
@@ -1,14 +1,12 @@
 { stdenv, fetchurl, fetchFromGitHub, cmake, pkgconfig
-, cudatoolkit, opencl-clhpp, ocl-icd, fftw, fftwFloat, mkl
-, blas, openblas, boost, mesa, libGLU, libGL
+, opencl-clhpp, ocl-icd, fftw, fftwFloat, mkl
+, blas, lapack, boost, mesa, libGLU, libGL
 , freeimage, python, clfft, clblas
 , doxygen, buildDocs ? false
+, cudaSupport ? false, cudatoolkit
 }:
 
-let
-  strOnLinux = stdenv.lib.optionalString stdenv.isLinux;
-
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   pname = "arrayfire";
   version = "3.6.4";
 
@@ -21,8 +19,7 @@ in stdenv.mkDerivation rec {
     "-DAF_BUILD_OPENCL=OFF"
     "-DAF_BUILD_EXAMPLES=OFF"
     "-DBUILD_TESTING=OFF"
-    (strOnLinux "-DCMAKE_LIBRARY_PATH=${cudatoolkit}/lib/stubs")
-  ];
+  ] ++ stdenv.lib.optional cudaSupport "-DCMAKE_LIBRARY_PATH=${cudatoolkit}/lib/stubs";
 
   patches = [ ./no-download.patch ];
 
@@ -35,7 +32,7 @@ in stdenv.mkDerivation rec {
     cp -R --no-preserve=mode,ownership ${opencl-clhpp}/include/CL/cl2.hpp ./build/include/CL/cl2.hpp
   '';
 
-  preBuild = strOnLinux ''
+  preBuild = stdenv.lib.optionalString cudaSupport ''
     export CUDA_PATH="${cudatoolkit}"
   '';
 
@@ -50,12 +47,13 @@ in stdenv.mkDerivation rec {
   buildInputs = [
     opencl-clhpp fftw fftwFloat
     mkl
-    openblas
+    blas lapack
     libGLU libGL
     mesa freeimage
     boost.out boost.dev
-  ] ++ (stdenv.lib.optional stdenv.isLinux [ cudatoolkit ocl-icd ])
-    ++ (stdenv.lib.optional buildDocs [ doxygen ]);
+  ] ++ (stdenv.lib.optional stdenv.isLinux ocl-icd)
+    ++ (stdenv.lib.optional cudaSupport cudatoolkit)
+    ++ (stdenv.lib.optional buildDocs doxygen);
 
   meta = with stdenv.lib; {
     description = "A general-purpose library for parallel and massively-parallel computations";
diff --git a/pkgs/development/libraries/flint/default.nix b/pkgs/development/libraries/flint/default.nix
index 48d7735498c..3c768fc472c 100644
--- a/pkgs/development/libraries/flint/default.nix
+++ b/pkgs/development/libraries/flint/default.nix
@@ -5,11 +5,11 @@
 , mpir
 , mpfr
 , ntl
-, openblas ? null
+, openblas ? null, blas, lapack
 , withBlas ? true
 }:
 
-assert withBlas -> openblas != null;
+assert withBlas -> openblas != null && blas.implementation == "openblas" && lapack.implementation == "openblas";
 
 stdenv.mkDerivation rec {
   pname = "flint";
diff --git a/pkgs/development/libraries/givaro/default.nix b/pkgs/development/libraries/givaro/default.nix
index 6011dd03a46..fdaf518c611 100644
--- a/pkgs/development/libraries/givaro/default.nix
+++ b/pkgs/development/libraries/givaro/default.nix
@@ -12,7 +12,8 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   nativeBuildInputs = [ autoreconfHook ];
-  buildInputs = [autoconf automake libtool gmpxx];
+  buildInputs = [autoconf automake libtool];
+  propagatedBuildInputs = [ gmpxx ];
 
   configureFlags = [
     "--disable-optimization"
diff --git a/pkgs/development/libraries/globalarrays/default.nix b/pkgs/development/libraries/globalarrays/default.nix
index 654fcc31eb7..423272fcd45 100644
--- a/pkgs/development/libraries/globalarrays/default.nix
+++ b/pkgs/development/libraries/globalarrays/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchpatch, fetchFromGitHub, autoreconfHook
-, openblas, gfortran, openssh, openmpi
+, blas, gfortran, openssh, openmpi
 } :
 
 let
@@ -17,7 +17,7 @@ in stdenv.mkDerivation {
   };
 
   nativeBuildInputs = [ autoreconfHook ];
-  buildInputs = [ openmpi openblas gfortran openssh ];
+  buildInputs = [ openmpi blas gfortran openssh ];
 
   preConfigure = ''
     configureFlagsArray+=( "--enable-i8" \
@@ -25,7 +25,7 @@ in stdenv.mkDerivation {
                            "--with-mpi3" \
                            "--enable-eispack" \
                            "--enable-underscoring" \
-                           "--with-blas8=${openblas}/lib -lopenblas" )
+                           "--with-blas8=${blas}/lib -lblas" )
   '';
 
   enableParallelBuilding = true;
@@ -38,5 +38,3 @@ in stdenv.mkDerivation {
     platforms = platforms.linux;
   };
 }
-
-
diff --git a/pkgs/development/libraries/iml/default.nix b/pkgs/development/libraries/iml/default.nix
index 598d7a58ef9..cf1d9018fd5 100644
--- a/pkgs/development/libraries/iml/default.nix
+++ b/pkgs/development/libraries/iml/default.nix
@@ -1,4 +1,4 @@
-{stdenv, autoreconfHook, fetchurl, gmp, openblas}:
+{stdenv, autoreconfHook, fetchurl, gmp, blas}:
 stdenv.mkDerivation rec {
   pname = "iml";
   version = "1.0.5";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
   };
   buildInputs = [
     gmp
-    openblas
+    blas
   ];
   nativeBuildInputs = [
     autoreconfHook
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--with-gmp-include=${gmp.dev}/include"
     "--with-gmp-lib=${gmp}/lib"
-    "--with-cblas=-lopenblas"
+    "--with-cblas=-lblas"
   ];
   meta = {
     inherit version;
diff --git a/pkgs/development/libraries/libcint/default.nix b/pkgs/development/libraries/libcint/default.nix
index e56583e45ba..3191dc44467 100644
--- a/pkgs/development/libraries/libcint/default.nix
+++ b/pkgs/development/libraries/libcint/default.nix
@@ -2,7 +2,7 @@
 , lib
 , fetchFromGitHub
 , cmake
-, openblas
+, blas
   # Check Inputs
 , python2
 }:
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake ];
-  buildInputs = [ openblas ];
+  buildInputs = [ blas ];
   cmakeFlags = [
     "-DENABLE_TEST=1"
     "-DQUICK_TEST=1"
diff --git a/pkgs/development/libraries/opencv/3.x.nix b/pkgs/development/libraries/opencv/3.x.nix
index ed337c7ebfe..6f327ca396a 100644
--- a/pkgs/development/libraries/opencv/3.x.nix
+++ b/pkgs/development/libraries/opencv/3.x.nix
@@ -11,7 +11,7 @@
 , enableEXR ?     !stdenv.isDarwin, openexr, ilmbase
 , enableJPEG2K    ? false, jasper  # disable jasper by default (many CVE)
 , enableEigen     ? true, eigen
-, enableOpenblas  ? true, openblas
+, enableOpenblas  ? true, openblas, blas, lapack
 , enableContrib   ? true
 
 , enableCuda      ? (config.cudaSupport or false) &&
@@ -35,6 +35,8 @@
 , AVFoundation, Cocoa, VideoDecodeAcceleration, bzip2
 }:
 
+assert blas.implementation == "openblas" && lapack.implementation == "openblas";
+
 let
   version = "3.4.8";
 
diff --git a/pkgs/development/libraries/opencv/4.x.nix b/pkgs/development/libraries/opencv/4.x.nix
index cec8a9aa363..abec6e1ace5 100644
--- a/pkgs/development/libraries/opencv/4.x.nix
+++ b/pkgs/development/libraries/opencv/4.x.nix
@@ -11,7 +11,7 @@
 , enableEXR ?     !stdenv.isDarwin, openexr, ilmbase
 , enableJPEG2K    ? false, jasper  # disable jasper by default (many CVE)
 , enableEigen     ? true, eigen
-, enableOpenblas  ? true, openblas
+, enableOpenblas  ? true, openblas, blas, lapack
 , enableContrib   ? true
 
 , enableCuda      ? (config.cudaSupport or false) &&
@@ -35,6 +35,8 @@
 , AVFoundation, Cocoa, VideoDecodeAcceleration, bzip2
 }:
 
+assert blas.implementation == "openblas" && lapack.implementation == "openblas";
+
 let
   version = "4.1.2";
 
diff --git a/pkgs/development/libraries/qrupdate/default.nix b/pkgs/development/libraries/qrupdate/default.nix
index a31cc4e8ed4..f6c16583ad7 100644
--- a/pkgs/development/libraries/qrupdate/default.nix
+++ b/pkgs/development/libraries/qrupdate/default.nix
@@ -1,7 +1,8 @@
 { stdenv
 , fetchurl
 , gfortran
-, openblas
+, blas
+, lapack
 }:
 stdenv.mkDerivation {
   name = "qrupdate-1.1.2";
@@ -13,11 +14,11 @@ stdenv.mkDerivation {
   configurePhase =
     ''
       export PREFIX=$out
-      sed -i -e 's,^BLAS=.*,BLAS=-L${openblas}/lib -lopenblas,' \
-          -e 's,^LAPACK=.*,LAPACK=-L${openblas}/lib -lopenblas,' \
+      sed -i -e 's,^BLAS=.*,BLAS=-L${blas}/lib -lblas,' \
+          -e 's,^LAPACK=.*,LAPACK=-L${lapack}/lib -llapack,' \
           Makeconf
     ''
-    + stdenv.lib.optionalString openblas.blas64
+    + stdenv.lib.optionalString blas.is64bit
     ''
       sed -i Makeconf -e '/^FFLAGS=.*/ s/$/-fdefault-integer-8/'
     '';
@@ -30,7 +31,7 @@ stdenv.mkDerivation {
 
   installTargets = stdenv.lib.optionals stdenv.isDarwin [ "install-staticlib" "install-shlib" ];
 
-  buildInputs = [ gfortran openblas ];
+  buildInputs = [ gfortran blas lapack ];
 
   meta = with stdenv.lib; {
     description = "Library for fast updating of qr and cholesky decompositions";
diff --git a/pkgs/development/libraries/science/math/arpack/default.nix b/pkgs/development/libraries/science/math/arpack/default.nix
index 961a1c544e6..a5fbb679df5 100644
--- a/pkgs/development/libraries/science/math/arpack/default.nix
+++ b/pkgs/development/libraries/science/math/arpack/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, cmake
-, gfortran, openblas, eigen }:
+, gfortran, blas, lapack, eigen }:
 
 with stdenv.lib;
 
@@ -18,15 +18,16 @@ stdenv.mkDerivation {
   };
 
   nativeBuildInputs = [ cmake ];
-  buildInputs = [ gfortran openblas eigen ];
+  buildInputs = [ gfortran blas lapack eigen ];
 
   doCheck = true;
 
-  BLAS_LIBS = "-L${openblas}/lib -lopenblas";
+  BLAS_LIBS = "-L${blas}/lib -lblas";
+  LAPACK_LIBS = "-L${lapack}/lib -llapack";
 
   cmakeFlags = [
     "-DBUILD_SHARED_LIBS=ON"
-    "-DINTERFACE64=${optionalString openblas.blas64 "1"}"
+    "-DINTERFACE64=${optionalString blas.is64bit "1"}"
   ];
 
   preCheck = if stdenv.isDarwin then ''
diff --git a/pkgs/development/libraries/science/math/cholmod-extra/default.nix b/pkgs/development/libraries/science/math/cholmod-extra/default.nix
index 0f2d35329c4..c381f56277e 100644
--- a/pkgs/development/libraries/science/math/cholmod-extra/default.nix
+++ b/pkgs/development/libraries/science/math/cholmod-extra/default.nix
@@ -1,10 +1,5 @@
-{ stdenv, fetchFromGitHub, gfortran, suitesparse, openblas }:
-let
-  suitesparse_ = suitesparse;
-in let
-  # SuiteSparse must use the same openblas
-  suitesparse = suitesparse_.override { inherit openblas; };
-in stdenv.mkDerivation rec {
+{ stdenv, fetchFromGitHub, gfortran, suitesparse, blas, lapack }:
+stdenv.mkDerivation rec {
   pname = "cholmod-extra";
   version = "1.2.0";
 
@@ -15,10 +10,10 @@ in stdenv.mkDerivation rec {
     sha256 = "0hz1lfp0zaarvl0dv0zgp337hyd8np41kmdpz5rr3fc6yzw7vmkg";
   };
 
-  buildInputs = [ suitesparse gfortran openblas ];
+  buildInputs = [ suitesparse gfortran blas lapack ];
 
-  buildFlags = [
-    "BLAS=-lopenblas"
+  makeFlags = [
+    "BLAS=-lcblas"
   ];
 
   installFlags = [
diff --git a/pkgs/development/libraries/science/math/fenics/default.nix b/pkgs/development/libraries/science/math/fenics/default.nix
index 2abf8e980b8..4e89aeebe2b 100644
--- a/pkgs/development/libraries/science/math/fenics/default.nix
+++ b/pkgs/development/libraries/science/math/fenics/default.nix
@@ -24,6 +24,8 @@
 , suitesparse
 , swig
 , zlib
+, blas
+, lapack
 }:
 let
   version = "2019.1.0";
@@ -176,13 +178,14 @@ let
       hdf5
       mpi
       numpy
-      (numpy.blas)
+      blas
+      lapack
       ply
       python
       scotch
       six
       sphinx
-      (suitesparse.override { openblas = numpy.blas; })
+      suitesparse
       swig
       sympy
       ufl
diff --git a/pkgs/development/libraries/science/math/ipopt/default.nix b/pkgs/development/libraries/science/math/ipopt/default.nix
index a3bc1c380cf..647fd82ec0e 100644
--- a/pkgs/development/libraries/science/math/ipopt/default.nix
+++ b/pkgs/development/libraries/science/math/ipopt/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchurl, unzip, openblas, gfortran }:
+{ stdenv, fetchurl, unzip, blas, lapack, gfortran }:
+
+assert (!blas.is64bit) && (!lapack.is64bit);
 
 stdenv.mkDerivation rec {
   pname = "ipopt";
@@ -12,13 +14,13 @@ stdenv.mkDerivation rec {
   CXXDEFS = [ "-DHAVE_RAND" "-DHAVE_CSTRING" "-DHAVE_CSTDIO" ];
 
   configureFlags = [
-    "--with-blas-lib=-lopenblas"
-    "--with-lapack-lib=-lopenblas"
+    "--with-blas-lib=-lblas"
+    "--with-lapack-lib=-llapack"
   ];
 
   nativeBuildInputs = [ unzip ];
 
-  buildInputs = [ gfortran openblas ];
+  buildInputs = [ gfortran blas lapack ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/science/math/magma/default.nix b/pkgs/development/libraries/science/math/magma/default.nix
index 5e62ce75aa6..b34139e7f48 100644
--- a/pkgs/development/libraries/science/math/magma/default.nix
+++ b/pkgs/development/libraries/science/math/magma/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, gfortran, cudatoolkit, libpthreadstubs, liblapack
+{ stdenv, fetchurl, cmake, gfortran, cudatoolkit, libpthreadstubs, lapack, blas
 , mklSupport ? false, mkl ? null
 }:
 
@@ -18,7 +18,7 @@ in stdenv.mkDerivation {
   };
 
   buildInputs = [ gfortran cudatoolkit libpthreadstubs cmake ]
-    ++ (if mklSupport then [ mkl ] else [ liblapack ]);
+    ++ (if mklSupport then [ mkl ] else [ lapack blas ]);
 
   doCheck = false;
 
diff --git a/pkgs/development/libraries/science/math/petsc/default.nix b/pkgs/development/libraries/science/math/petsc/default.nix
index 911f0a1cf89..200dd58a435 100644
--- a/pkgs/development/libraries/science/math/petsc/default.nix
+++ b/pkgs/development/libraries/science/math/petsc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv , fetchurl , blas , gfortran , liblapack , python }:
+{ stdenv , fetchurl , blas , gfortran , lapack , python }:
 
 stdenv.mkDerivation rec {
   pname = "petsc";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "0943bydmsq3sjwj3rxhb8hx58b1fm8vymny731557fs10g5zfbyz";
   };
 
-  nativeBuildInputs = [ blas gfortran.cc.lib liblapack python ];
+  nativeBuildInputs = [ blas gfortran.cc.lib lapack python ];
 
   prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
     substituteInPlace config/install.py \
@@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
       "--with-cxx=$CXX"
       "--with-fc=0"
       "--with-mpi=0"
-      "--with-blas-lib=[${blas}/lib/libblas.a,${gfortran.cc.lib}/lib/libgfortran.a]"
-      "--with-lapack-lib=[${liblapack}/lib/liblapack.a,${gfortran.cc.lib}/lib/libgfortran.a]"
+      "--with-blas-lib=[${blas}/lib/libblas.so,${gfortran.cc.lib}/lib/libgfortran.a]"
+      "--with-lapack-lib=[${lapack}/lib/liblapack.so,${gfortran.cc.lib}/lib/libgfortran.a]"
     )
   '';
 
diff --git a/pkgs/development/libraries/science/math/scalapack/default.nix b/pkgs/development/libraries/science/math/scalapack/default.nix
index f0a93c7be64..d2021986029 100644
--- a/pkgs/development/libraries/science/math/scalapack/default.nix
+++ b/pkgs/development/libraries/science/math/scalapack/default.nix
@@ -1,7 +1,8 @@
 { stdenv, fetchFromGitHub, cmake, openssh
-, gfortran, mpi, openblasCompat
+, gfortran, mpi, blas, lapack
 } :
 
+assert (!blas.is64bit) && (!lapack.is64bit);
 
 stdenv.mkDerivation rec {
   pname = "scalapack";
@@ -15,7 +16,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake openssh ];
-  buildInputs = [ mpi gfortran openblasCompat ];
+  buildInputs = [ mpi gfortran blas lapack ];
 
   enableParallelBuilding = true;
 
@@ -24,8 +25,8 @@ stdenv.mkDerivation rec {
   preConfigure = ''
     cmakeFlagsArray+=(
       -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF
-      -DLAPACK_LIBRARIES="-lopenblas"
-      -DBLAS_LIBRARIES="-lopenblas"
+      -DLAPACK_LIBRARIES="-llapack"
+      -DBLAS_LIBRARIES="-lblas"
       )
   '';
 
diff --git a/pkgs/development/libraries/science/math/scs/default.nix b/pkgs/development/libraries/science/math/scs/default.nix
index db808b093fe..7f7171f67e5 100644
--- a/pkgs/development/libraries/science/math/scs/default.nix
+++ b/pkgs/development/libraries/science/math/scs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, blas, liblapack, gfortran, fixDarwinDylibNames }:
+{ stdenv, fetchFromGitHub, blas, lapack, gfortran, fixDarwinDylibNames }:
 
 stdenv.mkDerivation rec {
   pname = "scs";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
-  buildInputs = [ blas liblapack gfortran.cc.lib ];
+  buildInputs = [ blas lapack gfortran.cc.lib ];
 
   doCheck = true;
 
diff --git a/pkgs/development/libraries/science/math/suitesparse/4.2.nix b/pkgs/development/libraries/science/math/suitesparse/4.2.nix
index 755a9f5118b..34a1fb7ad9e 100644
--- a/pkgs/development/libraries/science/math/suitesparse/4.2.nix
+++ b/pkgs/development/libraries/science/math/suitesparse/4.2.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchurl, gfortran, openblas }:
+{ stdenv, fetchurl, gfortran, blas, lapack }:
 
 let
-  int_t = if openblas.blas64 then "int64_t" else "int32_t";
+  int_t = if blas.is64bit then "int64_t" else "int32_t";
 in
 stdenv.mkDerivation rec {
   version = "4.2.1";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ gfortran ];
-  buildInputs = [ openblas ];
+  buildInputs = [ blas lapack ];
 
   preConfigure = ''
     mkdir -p $out/lib
@@ -29,8 +29,8 @@ stdenv.mkDerivation rec {
     "PREFIX=\"$(out)\""
     "INSTALL_LIB=$(out)/lib"
     "INSTALL_INCLUDE=$(out)/include"
-    "BLAS=-lopenblas"
-    "LAPACK="
+    "BLAS=-lblas"
+    "LAPACK=-llapack"
   ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/science/math/suitesparse/4.4.nix b/pkgs/development/libraries/science/math/suitesparse/4.4.nix
index 7f85f8e329e..b2b7e666b7e 100644
--- a/pkgs/development/libraries/science/math/suitesparse/4.4.nix
+++ b/pkgs/development/libraries/science/math/suitesparse/4.4.nix
@@ -1,12 +1,12 @@
-{ stdenv, fetchurl, gfortran, openblas
-, enableCuda  ? false, cudatoolkit
+{ stdenv, fetchurl, gfortran, blas, lapack
+, enableCuda ? false, cudatoolkit
 }:
 
 let
   version = "4.4.4";
   name = "suitesparse-${version}";
 
-  int_t = if openblas.blas64 then "int64_t" else "int32_t";
+  int_t = if blas.is64bit then "int64_t" else "int32_t";
   SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
 in
 stdenv.mkDerivation {
@@ -51,8 +51,8 @@ stdenv.mkDerivation {
     "PREFIX=\"$(out)\""
     "INSTALL_LIB=$(out)/lib"
     "INSTALL_INCLUDE=$(out)/include"
-    "BLAS=-lopenblas"
-    "LAPACK="
+    "BLAS=-lblas"
+    "LAPACK=-llapack"
   ];
 
   NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER";
@@ -64,7 +64,7 @@ stdenv.mkDerivation {
         for i in "$out"/lib/lib*.a; do
           ar -x $i
         done
-        ${if enableCuda then cudatoolkit else stdenv.cc.outPath}/bin/${if enableCuda then "nvcc" else "cc"} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse${SHLIB_EXT}" -lopenblas ${stdenv.lib.optionalString enableCuda "-lcublas"}
+        ${if enableCuda then cudatoolkit else stdenv.cc.outPath}/bin/${if enableCuda then "nvcc" else "cc"} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse${SHLIB_EXT}" -lblas ${stdenv.lib.optionalString enableCuda "-lcublas"}
     )
     for i in umfpack cholmod amd camd colamd spqr; do
       ln -s libsuitesparse${SHLIB_EXT} "$out"/lib/lib$i${SHLIB_EXT}
@@ -88,7 +88,7 @@ stdenv.mkDerivation {
   '';
 
   nativeBuildInputs = [ gfortran ];
-  buildInputs = [ openblas ];
+  buildInputs = [ blas lapack ];
 
   meta = with stdenv.lib; {
     homepage = "http://faculty.cse.tamu.edu/davis/suitesparse.html";
diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix
index 938ffb59996..48177987a7a 100644
--- a/pkgs/development/libraries/science/math/suitesparse/default.nix
+++ b/pkgs/development/libraries/science/math/suitesparse/default.nix
@@ -1,7 +1,7 @@
 { stdenv
 , fetchFromGitHub
 , gfortran
-, openblas
+, blas, lapack
 , metis
 , fixDarwinDylibNames
 , gnum4
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   buildInputs = [
-    openblas
+    blas lapack
     metis
     gfortran.cc.lib
   ] ++ stdenv.lib.optional enableCuda cudatoolkit;
@@ -41,10 +41,10 @@ stdenv.mkDerivation rec {
     "INSTALL=${placeholder "out"}"
     "INSTALL_INCLUDE=${placeholder "dev"}/include"
     "JOBS=$(NIX_BUILD_CORES)"
-    "BLAS=-lopenblas"
+    "BLAS=-lblas"
+    "LAPACK=-llapack"
     "MY_METIS_LIB=-lmetis"
-    "LAPACK="
-  ] ++ stdenv.lib.optionals openblas.blas64 [
+  ] ++ stdenv.lib.optionals blas.is64bit [
     "CFLAGS=-DBLAS64"
   ] ++ stdenv.lib.optionals enableCuda [
     "CUDA_PATH=${cudatoolkit}"
diff --git a/pkgs/development/libraries/science/math/superlu/default.nix b/pkgs/development/libraries/science/math/superlu/default.nix
index dc43dc21ea4..05ceb21387d 100644
--- a/pkgs/development/libraries/science/math/superlu/default.nix
+++ b/pkgs/development/libraries/science/math/superlu/default.nix
@@ -1,5 +1,7 @@
 { stdenv, fetchurl, cmake,
-  gfortran, openblasCompat}:
+  gfortran, blas, lapack}:
+
+assert (!blas.is64bit) && (!lapack.is64bit);
 
 stdenv.mkDerivation rec {
   version = "5.2.1";
@@ -12,7 +14,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ cmake gfortran ];
 
-  propagatedBuildInputs = [ openblasCompat ];
+  propagatedBuildInputs = [ blas ];
 
   cmakeFlags = [
     "-DBUILD_SHARED_LIBS=true"
@@ -20,7 +22,6 @@ stdenv.mkDerivation rec {
   ];
 
   patches = [
-    ./find-openblas-library.patch
     ./add-superlu-lib-as-dependency-for-the-unit-tests.patch
   ];
 
diff --git a/pkgs/development/libraries/science/math/superlu/find-openblas-library.patch b/pkgs/development/libraries/science/math/superlu/find-openblas-library.patch
deleted file mode 100644
index ce7bc6974c9..00000000000
--- a/pkgs/development/libraries/science/math/superlu/find-openblas-library.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -75,6 +75,8 @@ set(CMAKE_C_FLAGS_RELEASE "-O3" CACHE STRING "")
- ######################################################################
- #
- #--------------------- BLAS ---------------------
-+find_package(OpenBLAS)
-+set(TPL_BLAS_LIBRARIES ${OpenBLAS_LIBRARIES})
- if(NOT enable_blaslib)
-   if (TPL_BLAS_LIBRARIES)
-     set(BLAS_FOUND TRUE)
diff --git a/pkgs/development/libraries/sundials/2.x.nix b/pkgs/development/libraries/sundials/2.x.nix
index 2d8a8f55c67..08cbd52ba39 100644
--- a/pkgs/development/libraries/sundials/2.x.nix
+++ b/pkgs/development/libraries/sundials/2.x.nix
@@ -4,15 +4,13 @@
 , python
 # GNU Octave needs KLU for ODE solvers
 , suitesparse
-, liblapack
+, blas, lapack
 , gfortran
 , lapackSupport ? true }:
 
-let liblapackShared = liblapack.override {
-  shared = true;
-};
+assert (!blas.is64bit) && (!lapack.is64bit);
 
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   pname = "sundials";
   version = "2.7.0";
 
@@ -44,7 +42,7 @@ in stdenv.mkDerivation rec {
     "-DKLU_INCLUDE_DIR=${suitesparse}/include"
     "-DKLU_LIBRARY_DIR=${suitesparse}/lib"
     "-DLAPACK_ENABLE=ON"
-    "-DLAPACK_LIBRARIES=${liblapackShared}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary};${liblapackShared}/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}"
+    "-DLAPACK_LIBRARIES=${lapack}/lib/lapack${stdenv.hostPlatform.extensions.sharedLibrary};${blas}/lib/blas${stdenv.hostPlatform.extensions.sharedLibrary}"
   ];
 
   # flaky tests, and patch in https://github.com/LLNL/sundials/pull/21 doesn't apply cleanly for sundials_3
diff --git a/pkgs/development/libraries/sundials/default.nix b/pkgs/development/libraries/sundials/default.nix
index 2405b1b6fdc..8ed8d6cfcb5 100644
--- a/pkgs/development/libraries/sundials/default.nix
+++ b/pkgs/development/libraries/sundials/default.nix
@@ -2,17 +2,18 @@
 , cmake
 , fetchurl
 , python
-, openblas
+, blas
+, lapack
 , gfortran
 , lapackSupport ? true }:
 
-let openblas32 = openblas.override { blas64 = false; };
+assert (!blas.is64bit) && (!lapack.is64bit);
 
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   pname = "sundials";
   version = "5.1.0";
 
-  buildInputs = [ python ] ++ stdenv.lib.optionals (lapackSupport) [ gfortran openblas32 ];
+  buildInputs = [ python ] ++ stdenv.lib.optionals (lapackSupport) [ gfortran blas lapack ];
   nativeBuildInputs = [ cmake ];
 
   src = fetchurl {
@@ -33,7 +34,7 @@ in stdenv.mkDerivation rec {
   ] ++ stdenv.lib.optionals (lapackSupport) [
     "-DSUNDIALS_INDEX_TYPE=int32_t"
     "-DLAPACK_ENABLE=ON"
-    "-DLAPACK_LIBRARIES=${openblas32}/lib/libopenblas${stdenv.hostPlatform.extensions.sharedLibrary}"
+    "-DLAPACK_LIBRARIES=${lapack}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}"
   ];
 
   doCheck = true;
diff --git a/pkgs/development/ocaml-modules/lacaml/default.nix b/pkgs/development/ocaml-modules/lacaml/default.nix
index 41bfb3125e3..e4da2216a83 100644
--- a/pkgs/development/ocaml-modules/lacaml/default.nix
+++ b/pkgs/development/ocaml-modules/lacaml/default.nix
@@ -1,6 +1,7 @@
-{ stdenv, fetchFromGitHub, darwin, ocaml, findlib, dune, base, stdio, liblapack, blas }:
+{ stdenv, fetchFromGitHub, darwin, ocaml, findlib, dune, base, stdio, lapack, blas }:
 
 assert stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "4.05.0";
+assert (!blas.is64bit) && (!lapack.is64bit);
 
 stdenv.mkDerivation rec {
   pname = "ocaml${ocaml.version}-lacaml";
@@ -14,7 +15,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ ocaml findlib dune base stdio ];
-  propagatedBuildInputs = [ liblapack blas ] ++
+  propagatedBuildInputs = [ lapack blas ] ++
     stdenv.lib.optionals stdenv.isDarwin
       [ darwin.apple_sdk.frameworks.Accelerate ];
 
diff --git a/pkgs/development/ocaml-modules/owl/default.nix b/pkgs/development/ocaml-modules/owl/default.nix
index 7fa912d808d..c84743a8da5 100644
--- a/pkgs/development/ocaml-modules/owl/default.nix
+++ b/pkgs/development/ocaml-modules/owl/default.nix
@@ -6,11 +6,14 @@
 , eigen
 , stdio
 , stdlib-shims
-, openblasCompat
+, openblas, blas, lapack
 , owl-base
 , npy
 }:
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+assert blas.implementation == "openblas" && lapack.implementation == "openblas";
+
 buildDunePackage rec {
   pname = "owl";
 
@@ -19,7 +22,7 @@ buildDunePackage rec {
   checkInputs = [ alcotest ];
   buildInputs = [ dune-configurator ];
   propagatedBuildInputs = [
-    eigen stdio stdlib-shims openblasCompat owl-base npy
+    eigen stdio stdlib-shims openblas owl-base npy
   ];
 
   doCheck = !stdenv.isDarwin;  # https://github.com/owlbarn/owl/issues/462
diff --git a/pkgs/development/python-modules/cvxopt/default.nix b/pkgs/development/python-modules/cvxopt/default.nix
index b48f6b99136..9266f406b15 100644
--- a/pkgs/development/python-modules/cvxopt/default.nix
+++ b/pkgs/development/python-modules/cvxopt/default.nix
@@ -4,7 +4,7 @@
 , fetchPypi
 , isPyPy
 , python
-, openblasCompat # build segfaults with regular openblas
+, blas, lapack # build segfaults with 64-bit blas
 , suitesparse
 , glpk ? null
 , gsl ? null
@@ -14,6 +14,8 @@
 , withFftw ? true
 }:
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 buildPythonPackage rec {
   pname = "cvxopt";
   version = "1.2.4";
@@ -25,12 +27,13 @@ buildPythonPackage rec {
     sha256 = "1h9g79gxpgpy6xciqyypihw5q4ngp322lpkka1nkwk0ysybfsp7s";
   };
 
+  buildInputs = [ blas lapack ];
+
   # similar to Gsl, glpk, fftw there is also a dsdp interface
   # but dsdp is not yet packaged in nixpkgs
   preConfigure = ''
-    export CVXOPT_BLAS_LIB_DIR=${openblasCompat}/lib
-    export CVXOPT_BLAS_LIB=openblas
-    export CVXOPT_LAPACK_LIB=openblas
+    export CVXOPT_BLAS_LIB=blas
+    export CVXOPT_LAPACK_LIB=lapack
     export CVXOPT_SUITESPARSE_LIB_DIR=${lib.getLib suitesparse}/lib
     export CVXOPT_SUITESPARSE_INC_DIR=${lib.getDev suitesparse}/include
   '' + lib.optionalString withGsl ''
diff --git a/pkgs/development/python-modules/numpy/default.nix b/pkgs/development/python-modules/numpy/default.nix
index a863ef60d4a..949d5e5898b 100644
--- a/pkgs/development/python-modules/numpy/default.nix
+++ b/pkgs/development/python-modules/numpy/default.nix
@@ -5,21 +5,23 @@
 , gfortran
 , pytest
 , blas
+, lapack
 , writeTextFile
 , isPyPy
 , cython
 , setuptoolsBuildHook
  }:
 
+assert (!blas.is64bit) && (!lapack.is64bit);
+
 let
-  blasImplementation = lib.nameFromURL blas.name "-";
   cfg = writeTextFile {
     name = "site.cfg";
     text = (lib.generators.toINI {} {
-      ${blasImplementation} = {
-        include_dirs = "${blas}/include";
-        library_dirs = "${blas}/lib";
-      } // lib.optionalAttrs (blasImplementation == "mkl") {
+      ${blas.implementation} = {
+        include_dirs = "${blas}/include:${lapack}/include";
+        library_dirs = "${blas}/lib:${lapack}/lib";
+      } // lib.optionalAttrs (blas.implementation == "mkl") {
         mkl_libs = "mkl_rt";
         lapack_libs = "";
       };
@@ -37,7 +39,7 @@ in buildPythonPackage rec {
   };
 
   nativeBuildInputs = [ gfortran pytest cython setuptoolsBuildHook ];
-  buildInputs = [ blas ];
+  buildInputs = [ blas lapack ];
 
   patches = lib.optionals python.hasDistutilsCxxPatch [
     # We patch cpython/distutils to fix https://bugs.python.org/issue1222585
@@ -68,8 +70,10 @@ in buildPythonPackage rec {
   '';
 
   passthru = {
-    blas = blas;
-    inherit blasImplementation cfg;
+    # just for backwards compatibility
+    blas = blas.provider;
+    blasImplementation = blas.implementation;
+    inherit cfg;
   };
 
   # Disable test
diff --git a/pkgs/development/python-modules/prox-tv/default.nix b/pkgs/development/python-modules/prox-tv/default.nix
index 60482d45551..1cc2ab89360 100644
--- a/pkgs/development/python-modules/prox-tv/default.nix
+++ b/pkgs/development/python-modules/prox-tv/default.nix
@@ -1,13 +1,11 @@
 { lib
 , blas
+, lapack
 , buildPythonPackage
 , cffi
 , fetchFromGitHub
-, liblapack
 , nose
 , numpy
-, openblas
-, useOpenblas ? true
 }:
 
 buildPythonPackage {
@@ -21,8 +19,6 @@ buildPythonPackage {
     sha256 = "0mlrjbb5rw78dgijkr3bspmsskk6jqs9y7xpsgs35i46dvb327q5";
   };
 
-  patches = lib.optional useOpenblas ./use-openblas.patch;
-
   checkInputs = [
     nose
   ];
@@ -32,12 +28,7 @@ buildPythonPackage {
     cffi
   ];
 
-  buildInputs = (
-    if useOpenblas then
-      [ openblas ]
-    else
-      [ blas liblapack ]
-  );
+  buildInputs = [ blas lapack ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/python-modules/prox-tv/use-openblas.patch b/pkgs/development/python-modules/prox-tv/use-openblas.patch
deleted file mode 100644
index e96faa4d600..00000000000
--- a/pkgs/development/python-modules/prox-tv/use-openblas.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-index f100b35..448bbaf 100644
---- a/prox_tv/prox_tv_build.py
-+++ b/prox_tv/prox_tv_build.py
-@@ -109,6 +109,6 @@ ffi.set_source(
-     define_macros=[('NOMATLAB', 1)],
-     extra_compile_args=extra_compile_args,
-     extra_link_args=extra_link_args,
--    libraries=['blas', 'lapack'],
-+    libraries=['openblas'],
-     include_dirs=['/usr/include']
- )
diff --git a/pkgs/development/python-modules/pysparse/default.nix b/pkgs/development/python-modules/pysparse/default.nix
index 41f67a4140d..fda5ad59608 100644
--- a/pkgs/development/python-modules/pysparse/default.nix
+++ b/pkgs/development/python-modules/pysparse/default.nix
@@ -3,7 +3,8 @@
 , fetchFromGitHub
 , numpy
 , setuptools
-, liblapack
+, blas
+, lapack
 , isPy27
 , python
 }:
@@ -24,8 +25,8 @@ buildPythonPackage {
 
   propagatedBuildInputs = [
     numpy
-    numpy.blas
-    liblapack
+    blas
+    lapack
   ];
 
   # Include patches from working version of PySparse 1.3-dev in
diff --git a/pkgs/development/python-modules/scs/default.nix b/pkgs/development/python-modules/scs/default.nix
index 4e500d68535..128e9276608 100644
--- a/pkgs/development/python-modules/scs/default.nix
+++ b/pkgs/development/python-modules/scs/default.nix
@@ -2,7 +2,7 @@
 , buildPythonPackage
 , fetchFromGitHub
 , blas
-, liblapack
+, lapack
 , numpy
 , scipy
 , scs
@@ -26,7 +26,7 @@ buildPythonPackage rec {
   '';
 
   buildInputs = [
-    liblapack
+    lapack
     blas
   ];
 
diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix
index 5ee2423c983..44ff794654d 100644
--- a/pkgs/development/r-modules/default.nix
+++ b/pkgs/development/r-modules/default.nix
@@ -252,7 +252,7 @@ let
     data_table = [pkgs.zlib.dev] ++ lib.optional stdenv.isDarwin pkgs.llvmPackages.openmp;
     devEMF = [ pkgs.xorg.libXft.dev pkgs.x11 ];
     diversitree = [ pkgs.gsl_1 pkgs.fftw ];
-    EMCluster = [ pkgs.liblapack ];
+    EMCluster = [ pkgs.lapack ];
     fftw = [ pkgs.fftw.dev ];
     fftwtools = [ pkgs.fftw.dev ];
     Formula = [ pkgs.gmp ];
@@ -808,11 +808,11 @@ let
     });
 
     slfm = old.slfm.overrideDerivation (attrs: {
-      PKG_LIBS = "-L${pkgs.openblasCompat}/lib -lopenblas";
+      PKG_LIBS = "-L${pkgs.blas}/lib -lblas -L${pkgs.lapack}/lib -llapack";
     });
 
     SamplerCompare = old.SamplerCompare.overrideDerivation (attrs: {
-      PKG_LIBS = "-L${pkgs.openblasCompat}/lib -lopenblas";
+      PKG_LIBS = "-L${pkgs.blas}/lib -lblas -L${pkgs.lapack}/lib -llapack";
     });
 
     EMCluster = old.EMCluster.overrideDerivation (attrs: {
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
index 8301dcd49b8..04340ac4e89 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
@@ -275,20 +275,15 @@ self: super:
     old:
       let
         blas = old.passthru.args.blas or pkgs.openblasCompat;
-        blasImplementation = lib.nameFromURL blas.name "-";
+        lapack = old.passthru.args.lapack or pkgs.openblasCompat;
         cfg = pkgs.writeTextFile {
           name = "site.cfg";
-          text = (
-            lib.generators.toINI {} {
-              ${blasImplementation} = {
-                include_dirs = "${blas}/include";
-                library_dirs = "${blas}/lib";
-              } // lib.optionalAttrs (blasImplementation == "mkl") {
-                mkl_libs = "mkl_rt";
-                lapack_libs = "";
-              };
-            }
-          );
+          text = (lib.generators.toINI {} {
+            ${blas.implementation} = {
+              include_dirs = "${blas}/include:${lapack}/include";
+              library_dirs = "${blas}/lib:${lapack}/lib";
+            };
+          });
         };
       in
         {
@@ -299,8 +294,8 @@ self: super:
             ln -s ${cfg} site.cfg
           '';
           passthru = old.passthru // {
-            blas = blas;
-            inherit blasImplementation cfg;
+            blsaImplementation = blas.implementation;
+            inherit blas cfg;
           };
         }
   );
diff --git a/pkgs/servers/mail/rspamd/default.nix b/pkgs/servers/mail/rspamd/default.nix
index 7b9e766f246..7f54b97a8e8 100644
--- a/pkgs/servers/mail/rspamd/default.nix
+++ b/pkgs/servers/mail/rspamd/default.nix
@@ -1,6 +1,6 @@
 { stdenv, lib, fetchFromGitHub, cmake, perl
 , glib, luajit, openssl, pcre, pkgconfig, sqlite, ragel, icu
-, hyperscan, jemalloc, openblas, lua, libsodium
+, hyperscan, jemalloc, blas, lapack, lua, libsodium
 , withBlas ? true
 , withHyperscan ? stdenv.isx86_64
 , withLuaJIT ? stdenv.isx86_64
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkgconfig perl ];
   buildInputs = [ glib openssl pcre sqlite ragel icu jemalloc libsodium ]
     ++ lib.optional withHyperscan hyperscan
-    ++ lib.optional withBlas openblas
+    ++ lib.optionals withBlas [ blas lapack ]
     ++ lib.optional withLuaJIT luajit ++ lib.optional (!withLuaJIT) lua;
 
   cmakeFlags = [
diff --git a/pkgs/tools/misc/hpl/default.nix b/pkgs/tools/misc/hpl/default.nix
index 6cacbaf0b84..c131de02180 100644
--- a/pkgs/tools/misc/hpl/default.nix
+++ b/pkgs/tools/misc/hpl/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchurl, openblasCompat, mpi } :
+{ stdenv, fetchurl, blas, lapack, mpi } :
+
+assert (!blas.is64bit) && (!lapack.is64bit);
 
 stdenv.mkDerivation rec {
   pname = "hpl";
@@ -18,7 +20,7 @@ stdenv.mkDerivation rec {
     install -D testing/ptest/HPL.dat $out/share/hpl/HPL.dat
   '';
 
-  buildInputs = [ openblasCompat mpi ];
+  buildInputs = [ blas lapack mpi ];
 
   meta = with stdenv.lib; {
     description = "Portable Implementation of the Linpack Benchmark for Distributed-Memory Computers";
@@ -28,4 +30,3 @@ stdenv.mkDerivation rec {
     maintainers = [ maintainers.markuskowa ];
   };
 }
-
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1f11beb8ee3..3c9d5274abd 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8702,25 +8702,21 @@ in
 
   julia_07 = callPackage ../development/compilers/julia/0.7.nix {
     gmp = gmp6;
-    openblas = openblasCompat;
     inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
   };
 
   julia_10 = callPackage ../development/compilers/julia/1.0.nix {
     gmp = gmp6;
-    openblas = openblasCompat;
     inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
   };
 
   julia_11 = callPackage ../development/compilers/julia/1.1.nix {
     gmp = gmp6;
-    openblas = openblasCompat;
     inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
   };
 
   julia_13 = callPackage ../development/compilers/julia/1.3.nix {
     gmp = gmp6;
-    openblas = openblasCompat;
     inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
   };
 
@@ -9404,16 +9400,13 @@ in
 
   octave = callPackage ../development/interpreters/octave {
     python = python3;
-    openblas = if stdenv.isDarwin then openblasCompat else openblas;
   };
   octave-jit = callPackage ../development/interpreters/octave {
     python = python3;
-    openblas = if stdenv.isDarwin then openblasCompat else openblas;
     enableJIT = true;
   };
   octaveFull = (lowPrio (libsForQt512.callPackage ../development/interpreters/octave {
     python = python3;
-    openblas = if stdenv.isDarwin then openblasCompat else openblas;
     enableQt = true;
     overridePlatforms = ["x86_64-linux" "x86_64-darwin"];
   }));
@@ -15252,7 +15245,6 @@ in
     texLive = texlive.combine {
       inherit (texlive) scheme-small inconsolata helvetic texinfo fancyvrb cm-super;
     };
-    openblas = openblasCompat;
     withRecommendedPackages = false;
     inherit (darwin.apple_sdk.frameworks) Cocoa Foundation;
     inherit (darwin) libobjc;
@@ -24191,7 +24183,7 @@ in
 
   molden = callPackage ../applications/science/chemistry/molden { };
 
-  octopus = callPackage ../applications/science/chemistry/octopus { openblas=openblasCompat; };
+  octopus = callPackage ../applications/science/chemistry/octopus { };
 
   openmolcas = callPackage ../applications/science/chemistry/openmolcas { };
 
@@ -24532,7 +24524,7 @@ in
 
   sympow = callPackage ../development/libraries/science/math/sympow { };
 
-  ipopt = callPackage ../development/libraries/science/math/ipopt { openblas = openblasCompat; };
+  ipopt = callPackage ../development/libraries/science/math/ipopt { };
 
   gmsh = callPackage ../applications/science/math/gmsh { };
 
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 81e75d808ff..ac6b5f59220 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -4667,9 +4667,7 @@ in {
   Nuitka = callPackage ../development/python-modules/nuitka { };
 
   numpy = let
-    numpy_ = callPackage ../development/python-modules/numpy {
-      blas = pkgs.openblasCompat;
-    };
+    numpy_ = callPackage ../development/python-modules/numpy { };
     numpy_2 = numpy_.overridePythonAttrs(oldAttrs: rec {
       version = "1.16.5";
       src = oldAttrs.src.override {
@@ -4952,11 +4950,7 @@ in {
 
   promise = callPackage ../development/python-modules/promise { };
 
-  prox-tv = callPackage ../development/python-modules/prox-tv {
-    # We need to use blas instead of openblas on darwin,
-    # see https://github.com/NixOS/nixpkgs/pull/45013.
-    useOpenblas = ! stdenv.isDarwin;
-  };
+  prox-tv = callPackage ../development/python-modules/prox-tv { };
 
   pvlib = callPackage ../development/python-modules/pvlib { };