packages.vasp.nvidia: fix

This commit is contained in:
2024-12-22 14:49:41 +08:00
parent 7034ba20a8
commit e5a31d9113
2 changed files with 41 additions and 9 deletions

View File

@@ -63,15 +63,7 @@ inputs: rec
};
wannier90 = inputs.pkgs.wannier90.overrideAttrs { buildFlags = [ "dynlib" ]; };
};
hdf5-nvhpc = (inputs.pkgs.hdf5.override
{
stdenv = nvhpcStdenv;
cppSupport = false;
fortranSupport = true;
enableShared = false;
enableStatic = true;
# }).overrideAttrs (prev: { nativeBuildInputs = prev.nativeBuildInputs or [] ++ [ inputs.pkgs.cudaPackages.cudatoolkit ]; });
}).overrideAttrs (prev: { nativeBuildInputs = prev.nativeBuildInputs or [] ++ []; });
hdf5-nvhpc = inputs.pkgs.callPackage ./vasp/hdf5-nvhpc { inherit lmod nvhpc; inherit (inputs.pkgs.hdf5) src; };
vtst = (inputs.pkgs.callPackage ./vasp/vtst.nix {});
vtstscripts = inputs.pkgs.callPackage ./vasp/vtstscripts.nix {};
};

View File

@@ -0,0 +1,40 @@
{
buildFHSEnv, writeScript, stdenvNoCC,
src,
nvhpc, lmod, cmake, gfortran
}:
let
buildEnv = buildFHSEnv
{
name = "buildEnv";
targetPkgs = pkgs: with pkgs; [ zlib ];
extraBwrapArgs = [ "--bind" "$out" "$out" ];
};
buildScript = writeScript "build"
''
. ${lmod}/share/lmod/lmod/init/bash
module use ${nvhpc}/share/nvhpc/modulefiles
module load nvhpc
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$out -DHDF5_INSTALL_CMAKE_DIR=$out/lib/cmake \
-DHDF5_BUILD_FORTRAN=ON -DHDF5_ENABLE_PARALLEL=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF ..
make -j$NIX_BUILD_CORES
make install
'';
in stdenvNoCC.mkDerivation
{
name = "hdf5-nvhpc";
inherit src;
dontConfigure = true;
enableParallelBuilding = true;
nativeBuildInputs = [ cmake gfortran ];
buildPhase =
''
mkdir -p $out
${buildEnv}/bin/buildEnv ${buildScript}
'';
dontInstall = true;
dontFixup = true;
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" "big-parallel" ];
}