@@ -1,6 +1,8 @@
11{ lib, stdenv, fetchFromGitHub, python3, gfortran, blas, lapack
22, fftw, libint, libvori, libxc, mpi, gsl, scalapack, openssh, makeWrapper
3−, libxsmm, spglib, which, elpa, pkg-config
3+, libxsmm, spglib, which, pkg-config
4+, enableElpa ? false
5+, elpa
46} :
57
68let
@@ -21,7 +23,6 @@ in stdenv.mkDerivation rec {
2123
2224 nativeBuildInputs = [ python3 which openssh makeWrapper pkg-config ];
2325 buildInputs = [
24− elpa
2526 gfortran
2627 fftw
2728 gsl
@@ -33,7 +34,7 @@ in stdenv.mkDerivation rec {
3334 scalapack
3435 blas
3536 lapack
36− ];
37+ ] ++ lib.optional enableElpa elpa;
3738
3839 propagatedBuildInputs = [ mpi ];
3940 propagatedUserEnvPkgs = [ mpi ];
@@ -61,20 +62,20 @@ in stdenv.mkDerivation rec {
6162 AR = ar -r
6263 DFLAGS = -D__FFTW3 -D__LIBXC -D__LIBINT -D__parallel -D__SCALAPACK \
6364 -D__MPI_VERSION=3 -D__F2008 -D__LIBXSMM -D__SPGLIB \
64− -D__MAX_CONTR=4 -D__LIBVORI -D__ELPA
65+ -D__MAX_CONTR=4 -D__LIBVORI ${lib.optionalString enableElpa "-D__ELPA"}
6566 CFLAGS = -fopenmp
6667 FCFLAGS = \$(DFLAGS) -O2 -ffree-form -ffree-line-length-none \
6768 -ftree-vectorize -funroll-loops -msse2 \
6869 -std=f2008 \
6970 -fopenmp -ftree-vectorize -funroll-loops \
7071 -I${libxc}/include -I${libxsmm}/include \
71− -I${libint}/include $(pkg-config --variable=fcflags elpa)
72+ -I${libint}/include ${lib.optionalString enableElpa "$(pkg-config --variable=fcflags elpa)"}
7273 LIBS = -lfftw3 -lfftw3_threads \
7374 -lscalapack -lblas -llapack \
7475 -lxcf03 -lxc -lxsmmf -lxsmm -lsymspg \
7576 -lint2 -lstdc++ -lvori \
7677 -lgomp -lpthread -lm \
77− -fopenmp $(pkg-config --libs elpa)
78+ -fopenmp ${lib.optionalString enableElpa "$(pkg-config --libs elpa)"}
7879 LDFLAGS = \$(FCFLAGS) \$(LIBS)
7980 EOF
8081 '';