Commit 8b661bb8 authored by emaryn's avatar emaryn
Browse files

siesta: 4.1.5 -> 5.2.2

parent 5dab1e63
Loading
Loading
Loading
Loading
+29 −26
Original line number Diff line number Diff line
@@ -8,48 +8,56 @@
  useMpi ? false,
  mpi,
  fetchFromGitLab,
  cmake,
  pkg-config,
  readline,
  ninja,
  elpa,
}:

stdenv.mkDerivation rec {
  version = "4.1.5";
stdenv.mkDerivation (finalAttrs: {
  pname = "siesta";
  version = "5.2.2";

  src = fetchFromGitLab {
    owner = "siesta-project";
    repo = "siesta";
    rev = "v${version}";
    sha256 = "0lz8rfl5xwdj17zn7a30ipi7cgjwqki21a7wg9rdg7iwx27bpnmg";
    tag = finalAttrs.version;
    hash = "sha256-pud8RlJAT+0TwyPRsbf5D/8FfLjZvPYPf84Xb7UH6os=";
    fetchSubmodules = true;
  };

  postPatch = ''
    substituteInPlace Src/siesta_init.F --replace '/bin/rm' 'rm'
  '';

  passthru = {
    inherit mpi;
  };

  nativeBuildInputs = [ gfortran ];
  nativeBuildInputs = [
    ninja
    gfortran
    cmake
    pkg-config
  ];

  buildInputs =
    [
      blas
      lapack
      readline
      elpa
    ]
    ++ lib.optionals useMpi [
      mpi
      scalapack
    ];

  enableParallelBuilding = false; # Started making trouble with gcc-11
  NIX_LDFLAGS = "-lm";

  # Must do manually because siesta does not do the regular
  # ./configure; make; make install
  configurePhase = ''
    cd Obj
    sh ../Src/obj_setup.sh
    cp gfortran.make arch.make
  '';
  cmakeFlags = [
    "-DCMAKE_INSTALL_INCLUDEDIR=include"
    "-DCMAKE_INSTALL_LIBDIR=lib"
  ];

  enableParallelBuilding = false; # Started making trouble with gcc-11

  preBuild =
    ''
@@ -76,12 +84,7 @@ stdenv.mkDerivation rec {
        ''
    );

  installPhase = ''
    mkdir -p $out/bin
    cp -a siesta $out/bin
  '';

  meta = with lib; {
  meta = {
    description = "First-principles materials simulation code using DFT";
    mainProgram = "siesta";
    longDescription = ''
@@ -98,8 +101,8 @@ stdenv.mkDerivation rec {
      and all-electron methods.
    '';
    homepage = "https://siesta-project.org/siesta/";
    license = licenses.gpl2;
    license = lib.licenses.gpl2;
    platforms = [ "x86_64-linux" ];
    maintainers = [ maintainers.costrouc ];
    maintainers = [ lib.maintainers.costrouc ];
  };
}
})