1{ lib, stdenv, fetchFromGitLab, cmake, gfortran, perl }:
2
3stdenv.mkDerivation rec {
4 pname = "libxc";
5 version = "6.2.2";
6
7 src = fetchFromGitLab {
8 owner = "libxc";
9 repo = "libxc";
10 rev = version;
11 hash = "sha256-JYhuyW95I7Q0edLIe7H//+ej5vh6MdAGxXjmNxDMuhQ=";
12 };
13
14 # Timeout increase has already been included upstream in master.
15 # Check upon updates if this can be removed.
16 postPatch = ''
17 substituteInPlace testsuite/CMakeLists.txt \
18 --replace "PROPERTIES TIMEOUT 1" "PROPERTIES TIMEOUT 30"
19 '';
20
21 outputs = [ "out" "dev" ];
22
23 nativeBuildInputs = [ perl cmake gfortran ];
24
25 preConfigure = ''
26 patchShebangs ./
27 '';
28
29 cmakeFlags = [
30 "-DENABLE_FORTRAN=ON"
31 "-DBUILD_SHARED_LIBS=ON"
32 "-DENABLE_XHOST=OFF"
33 # Force compilation of higher derivatives
34 "-DDISABLE_VXC=0"
35 "-DDISABLE_FXC=0"
36 "-DDISABLE_KXC=0"
37 "-DDISABLE_LXC=0"
38 ];
39
40 doCheck = true;
41
42 meta = with lib; {
43 description = "Library of exchange-correlation functionals for density-functional theory";
44 homepage = "https://www.tddft.org/programs/Libxc/";
45 license = licenses.mpl20;
46 platforms = platforms.unix;
47 maintainers = with maintainers; [ markuskowa ];
48 };
49}