From d2239872cc54353a0ff1669f62c2b6c21e7c6fc4 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Sat, 15 Feb 2025 19:16:04 +0100 Subject: [PATCH 1/2] gromacs: 2024.5 -> 2025.0 --- .../molecular-dynamics/gromacs/default.nix | 6 ++-- .../{pkgconfig.patch => pkgconfig-2024.patch} | 0 .../gromacs/pkgconfig-2025.patch | 36 +++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) rename pkgs/applications/science/molecular-dynamics/gromacs/{pkgconfig.patch => pkgconfig-2024.patch} (100%) create mode 100644 pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig-2025.patch diff --git a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix index 5867656b2cbc..a62e716248e0 100644 --- a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix +++ b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix @@ -45,8 +45,8 @@ let } else { - version = "2024.5"; - hash = "sha256-/s8GsYbN25Qs+0LujaXz6yuZk+aswKLxjRSsCwFEJPM="; + version = "2025.0"; + hash = "sha256-onrTWmRilbvsEpq+aE2dA9Hi4L12sNYl6QVXRqrvroI="; }; in stdenv.mkDerivation rec { @@ -58,7 +58,7 @@ in stdenv.mkDerivation rec { inherit (source) hash; }; - patches = [ ./pkgconfig.patch ]; + patches = [ (if enablePlumed then ./pkgconfig-2024.patch else ./pkgconfig-2025.patch) ]; postPatch = lib.optionalString enablePlumed '' plumed patch -p -e gromacs-${source.version} diff --git a/pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig.patch b/pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig-2024.patch similarity index 100% rename from pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig.patch rename to pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig-2024.patch diff --git a/pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig-2025.patch b/pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig-2025.patch new file mode 100644 index 000000000000..f5f5e117ed24 --- /dev/null +++ b/pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig-2025.patch @@ -0,0 +1,36 @@ +diff --git a/src/external/muparser/muparser.pc.in b/src/external/muparser/muparser.pc.in +index 646787cb53..d26e84de8f 100644 +--- a/src/external/muparser/muparser.pc.in ++++ b/src/external/muparser/muparser.pc.in +@@ -1,11 +1,9 @@ +-prefix=@CMAKE_INSTALL_PREFIX@ +-exec_prefix=${prefix} +-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +- +-Name: @PACKAGE_NAME@ +-Description: Mathematical expressions parser library +-Version: @MUPARSER_VERSION@ +-Requires: +-Libs: -L${libdir} -lmuparser +-Cflags: -I${includedir} @PKG_CONFIG_FLAGS@ ++libdir=@CMAKE_INSTALL_FULL_LIBDIR@ ++includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ ++ ++Name: @PACKAGE_NAME@ ++Description: Mathematical expressions parser library ++Version: @MUPARSER_VERSION@ ++Requires: ++Libs: -L${libdir} -lmuparser ++Cflags: -I${includedir} @PKG_CONFIG_FLAGS@ +diff --git a/src/gromacs/libgromacs.pc.cmakein b/src/gromacs/libgromacs.pc.cmakein +index af9b5a6dc0..5f58d549bf 100644 +--- a/src/gromacs/libgromacs.pc.cmakein ++++ b/src/gromacs/libgromacs.pc.cmakein +@@ -1,5 +1,4 @@ +-prefix=@CMAKE_INSTALL_PREFIX@ +-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ ++libdir=@CMAKE_INSTALL_FULL_LIBDIR + + Name: libgromacs@GMX_LIBS_SUFFIX@ + Description: Gromacs library From 8bad41cc0f0f1d452147412fed6110d6abc660ad Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Sat, 15 Feb 2025 19:17:29 +0100 Subject: [PATCH 2/2] gromacs: apply nixfmt --- .../molecular-dynamics/gromacs/default.nix | 163 ++++++++++-------- 1 file changed, 95 insertions(+), 68 deletions(-) diff --git a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix index a62e716248e0..f9e70d712b27 100644 --- a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix +++ b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix @@ -1,25 +1,25 @@ -{ lib -, stdenv -, fetchurl -, cmake -, hwloc -, fftw -, perl -, blas -, lapack -, llvmPackages -, mpi -, cudaPackages -, plumed -, singlePrec ? true -, config -, enableCuda ? config.cudaSupport -, enableMpi ? false -, enablePlumed ? false -, cpuAcceleration ? null +{ + lib, + stdenv, + fetchurl, + cmake, + hwloc, + fftw, + perl, + blas, + lapack, + llvmPackages, + mpi, + cudaPackages, + plumed, + singlePrec ? true, + config, + enableCuda ? config.cudaSupport, + enableMpi ? false, + enablePlumed ? false, + cpuAcceleration ? null, }: - # CUDA is only implemented for single precission assert enableCuda -> singlePrec; @@ -30,12 +30,20 @@ let # The possible values are defined in CMakeLists.txt: # AUTO None SSE2 SSE4.1 AVX_128_FMA AVX_256 AVX2_256 # AVX2_128 AVX_512 AVX_512_KNL MIC ARM_NEON ARM_NEON_ASIMD - SIMD = x: if (cpuAcceleration != null) then x else - if stdenv.hostPlatform.system == "i686-linux" then "SSE2" else - if stdenv.hostPlatform.system == "x86_64-linux" then "SSE4.1" else - if stdenv.hostPlatform.system == "x86_64-darwin" then "SSE4.1" else - if stdenv.hostPlatform.system == "aarch64-linux" then "ARM_NEON_ASIMD" else - "None"; + SIMD = + x: + if (cpuAcceleration != null) then + x + else if stdenv.hostPlatform.system == "i686-linux" then + "SSE2" + else if stdenv.hostPlatform.system == "x86_64-linux" then + "SSE4.1" + else if stdenv.hostPlatform.system == "x86_64-darwin" then + "SSE4.1" + else if stdenv.hostPlatform.system == "aarch64-linux" then + "ARM_NEON_ASIMD" + else + "None"; source = if enablePlumed then @@ -49,7 +57,8 @@ let hash = "sha256-onrTWmRilbvsEpq+aE2dA9Hi4L12sNYl6QVXRqrvroI="; }; -in stdenv.mkDerivation rec { +in +stdenv.mkDerivation rec { pname = "gromacs"; version = source.version; @@ -64,58 +73,73 @@ in stdenv.mkDerivation rec { plumed patch -p -e gromacs-${source.version} ''; - outputs = [ "out" "dev" "man" ]; + outputs = [ + "out" + "dev" + "man" + ]; nativeBuildInputs = [ cmake ] ++ lib.optional enablePlumed plumed ++ lib.optionals enableCuda [ cudaPackages.cuda_nvcc ]; - buildInputs = [ - fftw - perl - hwloc - blas - lapack - ] ++ lib.optional enableMpi mpi - ++ lib.optionals enableCuda [ - cudaPackages.cuda_cccl - cudaPackages.cuda_cudart - cudaPackages.libcufft - cudaPackages.cuda_profiler_api - ] ++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp; + buildInputs = + [ + fftw + perl + hwloc + blas + lapack + ] + ++ lib.optional enableMpi mpi + ++ lib.optionals enableCuda [ + cudaPackages.cuda_cccl + cudaPackages.cuda_cudart + cudaPackages.libcufft + cudaPackages.cuda_profiler_api + ] + ++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp; propagatedBuildInputs = lib.optional enableMpi mpi; propagatedUserEnvPkgs = lib.optional enableMpi mpi; - cmakeFlags = [ - (lib.cmakeBool "GMX_HWLOC" true) - "-DGMX_SIMD:STRING=${SIMD cpuAcceleration}" - "-DGMX_OPENMP:BOOL=TRUE" - "-DBUILD_SHARED_LIBS=ON" - ] ++ ( - if singlePrec then [ - "-DGMX_DOUBLE=OFF" - ] else [ - "-DGMX_DOUBLE=ON" - "-DGMX_DEFAULT_SUFFIX=OFF" + cmakeFlags = + [ + (lib.cmakeBool "GMX_HWLOC" true) + "-DGMX_SIMD:STRING=${SIMD cpuAcceleration}" + "-DGMX_OPENMP:BOOL=TRUE" + "-DBUILD_SHARED_LIBS=ON" ] - ) ++ ( - if enableMpi - then [ - "-DGMX_MPI:BOOL=TRUE" - "-DGMX_THREAD_MPI:BOOL=FALSE" - ] - else [ - "-DGMX_MPI:BOOL=FALSE" - ] - ) ++ lib.optionals enableCuda [ - "-DGMX_GPU=CUDA" - (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cmakeCudaArchitecturesString) + ++ ( + if singlePrec then + [ + "-DGMX_DOUBLE=OFF" + ] + else + [ + "-DGMX_DOUBLE=ON" + "-DGMX_DEFAULT_SUFFIX=OFF" + ] + ) + ++ ( + if enableMpi then + [ + "-DGMX_MPI:BOOL=TRUE" + "-DGMX_THREAD_MPI:BOOL=FALSE" + ] + else + [ + "-DGMX_MPI:BOOL=FALSE" + ] + ) + ++ lib.optionals enableCuda [ + "-DGMX_GPU=CUDA" + (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cmakeCudaArchitecturesString) - # Gromacs seems to ignore and override the normal variables, so we add this ad hoc: - (lib.cmakeFeature "GMX_CUDA_TARGET_COMPUTE" cmakeCudaArchitecturesString) - ]; + # Gromacs seems to ignore and override the normal variables, so we add this ad hoc: + (lib.cmakeFeature "GMX_CUDA_TARGET_COMPUTE" cmakeCudaArchitecturesString) + ]; postInstall = '' moveToOutput share/cmake $dev @@ -145,6 +169,9 @@ in stdenv.mkDerivation rec { See: https://www.gromacs.org/about.html for details. ''; platforms = platforms.unix; - maintainers = with maintainers; [ sheepforce markuskowa ]; + maintainers = with maintainers; [ + sheepforce + markuskowa + ]; }; }