build-bazel-package: added rm of extra local folders for toolchain configuration...
[NixPkgs.git] / pkgs / by-name / ap / apbs / package.nix
blob41a05f70f9fc5b1bb64171932cce1ed1d5288adc
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   cmake,
6   blas,
7   superlu,
8   suitesparse,
9   python3,
10   libintl,
12 let
13   # this is a fork version of fetk (http://www.fetk.org/)
14   # which is maintained by apbs team
15   fetk = stdenv.mkDerivation (finalAttrs: {
16     pname = "fetk";
17     version = "1.9.3";
19     src = fetchFromGitHub {
20       owner = "Electrostatics";
21       repo = "fetk";
22       rev = "refs/tags/${finalAttrs.version}";
23       hash = "sha256-uFA1JRR05cNcUGaJj9IyGNONB2hU9IOBPzOj/HucNH4=";
24     };
26     nativeBuildInputs = [
27       cmake
28     ];
30     cmakeFlags = [
31       "-DBLAS_LIBRARIES=${blas}/lib"
32       "-DBLA_STATIC=OFF"
33       "-DBUILD_SUPERLU=OFF"
34     ];
36     env = lib.optionalAttrs stdenv.cc.isClang {
37       NIX_CFLAGS_COMPILE = "-Wno-error=implicit-int";
38     };
40     buildInputs = [
41       blas
42       superlu
43       suitesparse
44     ];
46     meta = with lib; {
47       description = "Fork of the Finite Element ToolKit from fetk.org";
48       homepage = "https://github.com/Electrostatics/FETK";
49       changelog = "https://github.com/Electrostatics/FETK/releases/tag/${finalAttrs.version}";
50       license = licenses.lgpl21Plus;
51       maintainers = with maintainers; [ natsukium ];
52       platforms = platforms.unix;
53     };
54   });
56 stdenv.mkDerivation (finalAttrs: {
57   pname = "apbs";
58   version = "3.4.1";
60   src = fetchFromGitHub {
61     owner = "Electrostatics";
62     repo = "apbs";
63     rev = "refs/tags/v${finalAttrs.version}";
64     hash = "sha256-2DnHU9hMDl4OJBaTtcRiB+6R7gAeFcuOUy7aI63A3gQ=";
65   };
67   postPatch = ''
68     # ImportFETK.cmake downloads source and builds fetk
69     substituteInPlace CMakeLists.txt \
70       --replace "include(ImportFETK)" "" \
71       --replace 'import_fetk(''${FETK_VERSION})' ""
73     # U was removed in python 3.11 because it had no effect
74     substituteInPlace tools/manip/inputgen.py \
75       --replace '"rU"' '"r"'
76   '';
78   nativeBuildInputs = [
79     cmake
80   ];
82   buildInputs =
83     [
84       fetk
85       suitesparse
86       blas
87       python3
88     ]
89     ++ lib.optionals stdenv.hostPlatform.isDarwin [
90       libintl
91     ];
93   cmakeFlags = [
94     "-DPYTHON_VERSION=${python3.version}"
95     "-DAPBS_LIBS=mc;maloc"
96     "-DCMAKE_MODULE_PATH=${fetk}/share/fetk/cmake;"
97     "-DENABLE_TESTS=1"
98   ];
100   env = lib.optionalAttrs stdenv.cc.isClang {
101     NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-function-pointer-types";
102   };
104   doCheck = true;
106   meta = with lib; {
107     description = "Software for biomolecular electrostatics and solvation calculations";
108     mainProgram = "apbs";
109     homepage = "https://www.poissonboltzmann.org/";
110     changelog = "https://github.com/Electrostatics/apbs/releases/tag/v${finalAttrs.version}";
111     license = licenses.bsd3;
112     maintainers = with maintainers; [ natsukium ];
113     platforms = platforms.unix;
114   };