Skip to content

Commit

Permalink
Merge pull request #315 from sheepforce/dalton-fix
Browse files Browse the repository at this point in the history
dalton: take care of git submodules manually
  • Loading branch information
markuskowa authored Aug 15, 2023
2 parents 86c61fa + 5d1dcc9 commit 75780c5
Showing 1 changed file with 57 additions and 17 deletions.
74 changes: 57 additions & 17 deletions pkgs/apps/dalton/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,48 @@

{ stdenv, lib, fetchgit, gfortran, cmake, makeWrapper
, which, openssh, blas, lapack, mpi, python3
} :
{ stdenv
, lib
, fetchurl
, fetchFromGitHub
, fetchFromGitLab
, gfortran
, cmake
, makeWrapper
, which
, openssh
, blas
, lapack
, mpi
, python3
}:

assert
lib.asserts.assertMsg
lib.asserts.assertMsg
(!blas.isILP64)
"A 32 bit integer implementation of BLAS is required.";

let
gen1intSrc = fetchFromGitLab {
owner = "bingao";
repo = "gen1int";
rev = "1e4148ecd676761b3399801acba443925a1fee6b";
hash = "sha256-kauwbL95TII3AVCs3H3oiy5DECqwh5JEuF/UhlBEnEE=";
};

pelibSrc = fetchFromGitLab {
owner = "pe-software";
repo = "pelib";
rev = "19dd0e91afbd18b7c9f2611b9978b1aeaa1c19f9";
hash = "sha256-sFgolAju05svkqozjAb2D5V0S48b9dHDOPRWD8F9fPs=";
};

qfitlibSrc = fetchFromGitHub {
owner = "cstein";
repo = "qfitlib";
rev = "1acdc9863fdeae2cdbc7f5a599413257a095b8ad";
hash = "sha256-GnGyWpNMrxsD9GNqGpzntDIpveDn3y4fG3m2zJbThwc=";
};


in
stdenv.mkDerivation rec {
pname = "dalton";
version = "2020.1";
Expand All @@ -29,23 +64,28 @@ stdenv.mkDerivation rec {
which
];

# Many submodules are required and they are not fetched by fetchFromGitLab.
src = fetchgit {
url = "https://gitlab.com/dalton/dalton.git";
rev = "9d7c5e435b75a9695d5ac8714121d12e6486149f"; # Git hash of 2020.1 as of 15.02.2022.
sha256 = "sha256-WTKouo+JfeZf1w5kflMO8X5uhgHnsO/3RXi44QzIdHk=";
deepClone = true;
src = fetchurl {
url = "https://gitlab.com/dalton/${pname}/-/archive/${version}/dalton-${version}.tar.bz2";
hash = "sha256-Rn1BZsJrQ0jYBUoQQafDpbpz19wc2LHWof5N6ZlKE1U=";
};

postPatch = "patchShebangs .";
postPatch = ''
cp -r ${gen1intSrc}/* external/gen1int/.
cp -r ${pelibSrc}/* external/pelib/.
cp -r ${qfitlibSrc}/* external/qfitlib/.
chmod -R +rwx external/*
patchShebangs .
'';

FC = "mpif90";
CC = "mpicc";
CXX = "mpicxx";

/*
Cmake is required to build but adding it to the buildinputs then ignores the setup script.
Therefore i call the script here manually but cmake is invoked by setup.
Cmake is required to build but adding it to the buildinputs then ignores the setup script.
Therefore i call the script here manually but cmake is invoked by setup.
*/
configurePhase = ''
./setup --prefix=$out --mpi && cd build
Expand All @@ -56,8 +96,8 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ];

/*
Dalton does not care about bin lib share directory structures and puts everything in a single
directory. Clean up the mess here.
Dalton does not care about bin lib share directory structures and puts everything in a single
directory. Clean up the mess here.
*/
postInstall = ''
mkdir -p $out/bin $out/share/dalton
Expand All @@ -76,7 +116,7 @@ stdenv.mkDerivation rec {
'';

/*
Make the MPI stuff available to the Dalton script. Direct exposure of MPI is not necessary.
Make the MPI stuff available to the Dalton script. Direct exposure of MPI is not necessary.
*/
postFixup = ''
wrapProgram $out/bin/dalton \
Expand Down

0 comments on commit 75780c5

Please sign in to comment.