summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/pc/pcmsolver/package.nix
blob: 2befb41e6355542d0a8860e0bf53f3b112538eb4 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  perl,
  gfortran,
  python3,
  boost,
  eigen,
  zlib,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "pcmsolver";
  version = "1.3.0";

  src = fetchFromGitHub {
    owner = "PCMSolver";
    repo = "pcmsolver";
    rev = "v${finalAttrs.version}";
    sha256 = "0jrxr8z21hjy7ik999hna9rdqy221kbkl3qkb06xw7g80rc9x9yr";
  };

  # Glibc 2.34 changed SIGSTKSZ to a dynamic value, which breaks
  # PCMsolver. Replace SIGSTKZ by the backward-compatible _SC_SIGSTKSZ.
  postPatch = ''
    substituteInPlace external/Catch/catch.hpp \
      --replace SIGSTKSZ _SC_SIGSTKSZ
  '';

  nativeBuildInputs = [
    cmake
    gfortran
    perl
    python3
  ];

  buildInputs = [
    boost
    eigen
    zlib
  ];

  # Required for build with gcc-14
  env.NIX_CFLAGS_COMPILE = "-std=c++14 -Wno-template-body";

  cmakeFlags = [
    "-DENABLE_OPENMP=ON"
    "-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
  ];

  hardeningDisable = [ "format" ];

  # Requires files, that are not installed.
  doCheck = false;

  meta = {
    description = "API for the Polarizable Continuum Model";
    mainProgram = "run_pcm";
    homepage = "https://pcmsolver.readthedocs.io/en/stable/";
    license = lib.licenses.lgpl3Only;
    platforms = lib.platforms.linux;
    maintainers = [ lib.maintainers.sheepforce ];
  };
})