nixpkgs/pkgs/applications/science/chemistry/siesta/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

70 lines
2.0 KiB
Nix

{ lib, stdenv, fetchurl
, gfortran, blas, lapack
, mpi ? null, scalapack
}:
stdenv.mkDerivation {
version = "4.1-b3";
pname = "siesta";
src = fetchurl {
url = "https://launchpad.net/siesta/4.1/4.1-b3/+download/siesta-4.1-b3.tar.gz";
sha256 = "1450jsxj5aifa0b5fcg7mxxq242fvqnp4zxpgzgbkdp99vrp06gm";
};
passthru = {
inherit mpi;
};
buildInputs = [ blas lapack gfortran ]
++ (stdenv.lib.optionals (mpi != null) [ mpi scalapack ]);
enableParallelBuilding = true;
# Must do manualy becuase siesta does not do the regular
# ./configure; make; make install
configurePhase = ''
cd Obj
sh ../Src/obj_setup.sh
cp gfortran.make arch.make
'';
preBuild = if (mpi != null) then ''
makeFlagsArray=(
CC="mpicc" FC="mpifort"
FPPFLAGS="-DMPI" MPI_INTERFACE="libmpi_f90.a" MPI_INCLUDE="."
COMP_LIBS="" LIBS="-lblas -llapack -lscalapack"
);
'' else ''
makeFlagsArray=(
COMP_LIBS="" LIBS="-lblas -llapack"
);
'';
installPhase = ''
mkdir -p $out/bin
cp -a siesta $out/bin
'';
meta = with lib; {
description = "A first-principles materials simulation code using DFT";
longDescription = ''
SIESTA is both a method and its computer program
implementation, to perform efficient electronic structure
calculations and ab initio molecular dynamics simulations of
molecules and solids. SIESTA's efficiency stems from the use
of strictly localized basis sets and from the implementation
of linear-scaling algorithms which can be applied to suitable
systems. A very important feature of the code is that its
accuracy and cost can be tuned in a wide range, from quick
exploratory calculations to highly accurate simulations
matching the quality of other approaches, such as plane-wave
and all-electron methods.
'';
homepage = "https://www.quantum-espresso.org/";
license = licenses.gpl2;
platforms = [ "x86_64-linux" ];
maintainers = [ maintainers.costrouc ];
};
}