about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/science/chemistry/mctc-lib/default.nix
blob: a3726ea5e5dd668195037f039729ba1ebc47e958 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ stdenv
, lib
, fetchFromGitHub
, gfortran
, pkg-config
, json-fortran
, cmake
}:

stdenv.mkDerivation rec {
  pname = "mctc-lib";
  version = "0.3.1";

  src = fetchFromGitHub {
    owner = "grimme-lab";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-AXjg/ZsitdDf9fNoGVmVal1iZ4/sxjJb7A9W4yye/rg=";
  };

  nativeBuildInputs = [ gfortran pkg-config cmake ];

  buildInputs = [ json-fortran ];

  outputs = [ "out" "dev" ];

  # Fix the Pkg-Config files for doubled store paths
  postPatch = ''
    substituteInPlace config/template.pc \
      --replace "\''${prefix}/" ""
  '';

  cmakeFlags = [
    "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
  ];

  doCheck = true;

  meta = with lib; {
    description = "Modular computation tool chain library";
    homepage = "https://github.com/grimme-lab/mctc-lib";
    license = licenses.asl20;
    platforms = platforms.linux;
    maintainers = [ maintainers.sheepforce ];
  };
}