nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 gfortran,
6 meson,
7 ninja,
8 cmake,
9 pkg-config,
10 mctc-lib,
11 mstore,
12 toml-f,
13 blas,
14 buildType ? "meson",
15}:
16
17assert !blas.isILP64;
18assert (
19 builtins.elem buildType [
20 "meson"
21 "cmake"
22 ]
23);
24
25stdenv.mkDerivation rec {
26 pname = "simple-dftd3";
27 version = "1.2.1";
28
29 src = fetchFromGitHub {
30 owner = "dftd3";
31 repo = "simple-dftd3";
32 tag = "v${version}";
33 hash = "sha256-c4xctcMcPQ70ippqbwtinygmnZ5en6ZGF5/v0ZWtzys=";
34 };
35
36 patches = [
37 ./cmake.patch
38 ];
39
40 nativeBuildInputs = [
41 gfortran
42 pkg-config
43 ]
44 ++ lib.optionals (buildType == "meson") [
45 meson
46 ninja
47 ]
48 ++ lib.optional (buildType == "cmake") cmake;
49
50 buildInputs = [
51 mctc-lib
52 mstore
53 toml-f
54 blas
55 ];
56
57 outputs = [
58 "out"
59 "dev"
60 ];
61
62 cmakeFlags = [
63 (lib.strings.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
64 ];
65
66 doCheck = true;
67 preCheck = ''
68 export OMP_NUM_THREADS=2
69 '';
70
71 meta = {
72 description = "Reimplementation of the DFT-D3 program";
73 mainProgram = "s-dftd3";
74 license = with lib.licenses; [
75 lgpl3Only
76 gpl3Only
77 ];
78 homepage = "https://github.com/dftd3/simple-dftd3";
79 platforms = lib.platforms.linux;
80 maintainers = [ lib.maintainers.sheepforce ];
81 };
82}