From 96eb942c2a62de7e04ec42112c788ee4f5fda226 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 07:20:02 +0300 Subject: [PATCH 01/12] pmix: use finalAttrs: pattern --- pkgs/development/libraries/pmix/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index 31325bd4ba0a..3f12be268c5e 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -4,14 +4,14 @@ , hwloc, munge, zlib, pandoc, gitMinimal } : -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "pmix"; version = "5.0.3"; src = fetchFromGitHub { repo = "openpmix"; owner = "openpmix"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-5qBZj4L0Qu/RvNj8meL0OlLCdfGvBP0D916Mr+0XOCQ="; fetchSubmodules = true; }; @@ -85,5 +85,5 @@ stdenv.mkDerivation rec { maintainers = [ maintainers.markuskowa ]; platforms = platforms.linux; }; -} +}) From 9c6f3ae8ae1a8f0bf4fd8df5fb5c9c85460dd7a1 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 07:20:40 +0300 Subject: [PATCH 02/12] pmix: don't use with lib; in meta --- pkgs/development/libraries/pmix/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index 3f12be268c5e..b3b761b2ff5d 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -78,12 +78,12 @@ stdenv.mkDerivation (finalAttrs: { enableParallelBuilding = true; - meta = with lib; { + meta = { description = "Process Management Interface for HPC environments"; homepage = "https://openpmix.github.io/"; - license = licenses.bsd3; - maintainers = [ maintainers.markuskowa ]; - platforms = platforms.linux; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ markuskowa ]; + platforms = lib.platforms.linux; }; }) From 4a17df26e4f24130b31b63eef1c2ab1a65a2bdfd Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 07:21:05 +0300 Subject: [PATCH 03/12] pmix: add doronbehar to maintainers --- pkgs/development/libraries/pmix/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index b3b761b2ff5d..5ce6dfd7cba5 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -82,7 +82,7 @@ stdenv.mkDerivation (finalAttrs: { description = "Process Management Interface for HPC environments"; homepage = "https://openpmix.github.io/"; license = lib.licenses.bsd3; - maintainers = with lib.maintainers; [ markuskowa ]; + maintainers = with lib.maintainers; [ markuskowa doronbehar ]; platforms = lib.platforms.linux; }; }) From 85e1c49cdbe21472cbadfb81cb55938f19fce243 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 07:21:40 +0300 Subject: [PATCH 04/12] pmix: nixfmt --- pkgs/development/libraries/pmix/default.nix | 43 ++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index 5ce6dfd7cba5..0f51b96d5609 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -1,8 +1,23 @@ -{ lib, stdenv, fetchFromGitHub, perl, autoconf, automake -, removeReferencesTo, libtool, python3, flex, libevent -, targetPackages, makeWrapper -, hwloc, munge, zlib, pandoc, gitMinimal -} : +{ + lib, + stdenv, + fetchFromGitHub, + perl, + autoconf, + automake, + removeReferencesTo, + libtool, + python3, + flex, + libevent, + targetPackages, + makeWrapper, + hwloc, + munge, + zlib, + pandoc, + gitMinimal, +}: stdenv.mkDerivation (finalAttrs: { pname = "pmix"; @@ -16,7 +31,10 @@ stdenv.mkDerivation (finalAttrs: { fetchSubmodules = true; }; - outputs = [ "out" "dev" ]; + outputs = [ + "out" + "dev" + ]; postPatch = '' patchShebangs ./autogen.pl @@ -36,7 +54,12 @@ stdenv.mkDerivation (finalAttrs: { makeWrapper ]; - buildInputs = [ libevent hwloc munge zlib ]; + buildInputs = [ + libevent + hwloc + munge + zlib + ]; configureFlags = [ "--with-libevent=${lib.getDev libevent}" @@ -82,8 +105,10 @@ stdenv.mkDerivation (finalAttrs: { description = "Process Management Interface for HPC environments"; homepage = "https://openpmix.github.io/"; license = lib.licenses.bsd3; - maintainers = with lib.maintainers; [ markuskowa doronbehar ]; + maintainers = with lib.maintainers; [ + markuskowa + doronbehar + ]; platforms = lib.platforms.linux; }; }) - From 97a89f6d197f233115831ea1fe08894ffd55c8d9 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 07:23:47 +0300 Subject: [PATCH 05/12] pmix: use "''${!outputDev}" instead of $dev This allows disabling multiple outputs more easily, as the first will evaluate to $out if a "dev" output is not enabled. --- pkgs/development/libraries/pmix/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index 0f51b96d5609..95ef2610841a 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -82,19 +82,19 @@ stdenv.mkDerivation (finalAttrs: { # The path to the pmixcc-wrapper-data.txt is hard coded and # points to $out instead of dev. Use wrapper to fix paths. - wrapProgram $dev/bin/pmixcc \ - --set PMIX_INCLUDEDIR $dev/include \ - --set PMIX_PKGDATADIR $dev/share/pmix + wrapProgram "''${!outputDev}"/bin/pmixcc \ + --set PMIX_INCLUDEDIR "''${!outputDev}"/include \ + --set PMIX_PKGDATADIR "''${!outputDev}"/share/pmix ''; postFixup = '' # The build info (parameters to ./configure) are hardcoded # into the library. This clears all references to $dev/include. - remove-references-to -t $dev $(readlink -f $out/lib/libpmix.so) + remove-references-to -t "''${!outputDev}" $(readlink -f $out/lib/libpmix.so) # Pin the compiler to the current version in a cross compiler friendly way. # Same pattern as for openmpi (see https://github.com/NixOS/nixpkgs/pull/58964#discussion_r275059427). - substituteInPlace $dev/share/pmix/pmixcc-wrapper-data.txt \ + substituteInPlace "''${!outputDev}"/share/pmix/pmixcc-wrapper-data.txt \ --replace-fail compiler=gcc \ compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc ''; From 7c189828223f55f7fc07a01bc6d860e44918f690 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 07:28:04 +0300 Subject: [PATCH 06/12] pmix: put substitution & wrapping in install & fixup respectively Make it match the same pattern as in openmpi. --- pkgs/development/libraries/pmix/default.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index 95ef2610841a..2f4a616f76e3 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -80,11 +80,11 @@ stdenv.mkDerivation (finalAttrs: { moveToOutput "bin/pmixcc" "''${!outputDev}" moveToOutput "share/pmix/pmixcc-wrapper-data.txt" "''${!outputDev}" - # The path to the pmixcc-wrapper-data.txt is hard coded and - # points to $out instead of dev. Use wrapper to fix paths. - wrapProgram "''${!outputDev}"/bin/pmixcc \ - --set PMIX_INCLUDEDIR "''${!outputDev}"/include \ - --set PMIX_PKGDATADIR "''${!outputDev}"/share/pmix + # Pin the compiler to the current version in a cross compiler friendly way. + # Same pattern as for openmpi (see https://github.com/NixOS/nixpkgs/pull/58964#discussion_r275059427). + substituteInPlace "''${!outputDev}"/share/pmix/pmixcc-wrapper-data.txt \ + --replace-fail compiler=gcc \ + compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc ''; postFixup = '' @@ -92,11 +92,11 @@ stdenv.mkDerivation (finalAttrs: { # into the library. This clears all references to $dev/include. remove-references-to -t "''${!outputDev}" $(readlink -f $out/lib/libpmix.so) - # Pin the compiler to the current version in a cross compiler friendly way. - # Same pattern as for openmpi (see https://github.com/NixOS/nixpkgs/pull/58964#discussion_r275059427). - substituteInPlace "''${!outputDev}"/share/pmix/pmixcc-wrapper-data.txt \ - --replace-fail compiler=gcc \ - compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc + # The path to the pmixcc-wrapper-data.txt is hard coded and + # points to $out instead of dev. Use wrapper to fix paths. + wrapProgram "''${!outputDev}"/bin/pmixcc \ + --set PMIX_INCLUDEDIR "''${!outputDev}"/include \ + --set PMIX_PKGDATADIR "''${!outputDev}"/share/pmix ''; enableParallelBuilding = true; From 3019956f12fd4c2936e8e33ceb203909d52aa9b1 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 07:22:09 +0300 Subject: [PATCH 07/12] pmix: enable on all platforms Disable multiple outputs on non Linux platforms, and don't perform wrapper-data substitution on non-Linux platforms. --- pkgs/development/libraries/pmix/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index 2f4a616f76e3..ed3496b45852 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -33,6 +33,7 @@ stdenv.mkDerivation (finalAttrs: { outputs = [ "out" + ] ++ lib.optionals stdenv.isLinux [ "dev" ]; @@ -80,6 +81,11 @@ stdenv.mkDerivation (finalAttrs: { moveToOutput "bin/pmixcc" "''${!outputDev}" moveToOutput "share/pmix/pmixcc-wrapper-data.txt" "''${!outputDev}" + '' + # From some reason the Darwin build doesn't include this file, so we + # currently disable this substitution for any non-Linux platform, until a + # Darwin user will care enough about this cross platform fix. + + lib.optionalString stdenv.isLinux '' # Pin the compiler to the current version in a cross compiler friendly way. # Same pattern as for openmpi (see https://github.com/NixOS/nixpkgs/pull/58964#discussion_r275059427). substituteInPlace "''${!outputDev}"/share/pmix/pmixcc-wrapper-data.txt \ @@ -88,6 +94,7 @@ stdenv.mkDerivation (finalAttrs: { ''; postFixup = '' + '' + lib.optionalString (lib.elem "dev" finalAttrs.outputs) '' # The build info (parameters to ./configure) are hardcoded # into the library. This clears all references to $dev/include. remove-references-to -t "''${!outputDev}" $(readlink -f $out/lib/libpmix.so) @@ -109,6 +116,5 @@ stdenv.mkDerivation (finalAttrs: { markuskowa doronbehar ]; - platforms = lib.platforms.linux; }; }) From 511be509f295ab4d409e4b42478eb0ddcd6f9fb7 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 17:21:01 +0300 Subject: [PATCH 08/12] pmix: nixfmt --- pkgs/development/libraries/pmix/default.nix | 32 +++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index ed3496b45852..69e86acfef23 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -31,11 +31,7 @@ stdenv.mkDerivation (finalAttrs: { fetchSubmodules = true; }; - outputs = [ - "out" - ] ++ lib.optionals stdenv.isLinux [ - "dev" - ]; + outputs = [ "out" ] ++ lib.optionals stdenv.isLinux [ "dev" ]; postPatch = '' patchShebangs ./autogen.pl @@ -74,27 +70,27 @@ stdenv.mkDerivation (finalAttrs: { ./autogen.pl ''; - postInstall = '' - find $out/lib/ -name "*.la" -exec rm -f \{} \; + postInstall = + '' + find $out/lib/ -name "*.la" -exec rm -f \{} \; - moveToOutput "bin/pmix_info" "''${!outputDev}" - moveToOutput "bin/pmixcc" "''${!outputDev}" - moveToOutput "share/pmix/pmixcc-wrapper-data.txt" "''${!outputDev}" + moveToOutput "bin/pmix_info" "''${!outputDev}" + moveToOutput "bin/pmixcc" "''${!outputDev}" + moveToOutput "share/pmix/pmixcc-wrapper-data.txt" "''${!outputDev}" '' # From some reason the Darwin build doesn't include this file, so we # currently disable this substitution for any non-Linux platform, until a # Darwin user will care enough about this cross platform fix. + lib.optionalString stdenv.isLinux '' - # Pin the compiler to the current version in a cross compiler friendly way. - # Same pattern as for openmpi (see https://github.com/NixOS/nixpkgs/pull/58964#discussion_r275059427). - substituteInPlace "''${!outputDev}"/share/pmix/pmixcc-wrapper-data.txt \ - --replace-fail compiler=gcc \ - compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc - ''; + # Pin the compiler to the current version in a cross compiler friendly way. + # Same pattern as for openmpi (see https://github.com/NixOS/nixpkgs/pull/58964#discussion_r275059427). + substituteInPlace "''${!outputDev}"/share/pmix/pmixcc-wrapper-data.txt \ + --replace-fail compiler=gcc \ + compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc + ''; - postFixup = '' - '' + lib.optionalString (lib.elem "dev" finalAttrs.outputs) '' + postFixup = lib.optionalString (lib.elem "dev" finalAttrs.outputs) '' # The build info (parameters to ./configure) are hardcoded # into the library. This clears all references to $dev/include. remove-references-to -t "''${!outputDev}" $(readlink -f $out/lib/libpmix.so) From 06d68ea13a421d5ebd9da352d40846d0875b3858 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 15:28:18 +0300 Subject: [PATCH 09/12] openmpi: add doronbehar to maintainers --- pkgs/development/libraries/openmpi/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix index c695571ff1f8..4681504397c3 100644 --- a/pkgs/development/libraries/openmpi/default.nix +++ b/pkgs/development/libraries/openmpi/default.nix @@ -263,7 +263,10 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://www.open-mpi.org/"; description = "Open source MPI-3 implementation"; longDescription = "The Open MPI Project is an open source MPI-3 implementation that is developed and maintained by a consortium of academic, research, and industry partners. Open MPI is therefore able to combine the expertise, technologies, and resources from all across the High Performance Computing community in order to build the best MPI library available. Open MPI offers advantages for system and software vendors, application developers and computer science researchers."; - maintainers = with lib.maintainers; [ markuskowa ]; + maintainers = with lib.maintainers; [ + markuskowa + doronbehar + ]; license = lib.licenses.bsd3; platforms = lib.platforms.unix; }; From 908ec599a34b1f8c98717b67d38582f33384d876 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 8 Aug 2024 08:02:24 +0300 Subject: [PATCH 10/12] openmpi: 5.0.3 -> 5.0.5 --- pkgs/development/libraries/openmpi/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix index 4681504397c3..992a16426363 100644 --- a/pkgs/development/libraries/openmpi/default.nix +++ b/pkgs/development/libraries/openmpi/default.nix @@ -40,11 +40,11 @@ stdenv.mkDerivation (finalAttrs: { pname = "openmpi"; - version = "5.0.3"; + version = "5.0.5"; src = fetchurl { url = "https://www.open-mpi.org/software/ompi/v${lib.versions.majorMinor finalAttrs.version}/downloads/openmpi-${finalAttrs.version}.tar.bz2"; - sha256 = "sha256-mQWC8gazqzLpOKoxu/B8Y5No5EBdyhlvq+fw927tqQs="; + sha256 = "sha256-ZYjVfApL0pmiQQP04ZYFGynotV+9pJ4R1bPTIDCjJ3Y="; }; postPatch = '' From af0df905e6ca24d7bcc0dd2618e23e2eed7164e7 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 7 Aug 2024 18:48:33 +0300 Subject: [PATCH 11/12] openmpi: fix configurePhase on darwin by always using our pmix --- pkgs/development/libraries/openmpi/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix index 992a16426363..a70e3ce787d7 100644 --- a/pkgs/development/libraries/openmpi/default.nix +++ b/pkgs/development/libraries/openmpi/default.nix @@ -116,8 +116,8 @@ stdenv.mkDerivation (finalAttrs: { (lib.enableFeature cudaSupport "mca-dso") (lib.enableFeature fortranSupport "mpi-fortran") (lib.withFeatureAs stdenv.isLinux "libnl" (lib.getDev libnl)) - "--with-pmix=${if stdenv.isLinux then (lib.getDev pmix) else "internal"}" - (lib.withFeatureAs stdenv.isLinux "pmix-libdir" "${lib.getLib pmix}/lib") + "--with-pmix=${lib.getDev pmix}" + "--with-pmix-libdir=${lib.getLib pmix}/lib" # Puts a "default OMPI_PRTERUN" value to mpirun / mpiexec executables (lib.withFeatureAs stdenv.isLinux "prrte" (lib.getBin prrte)) (lib.withFeature enableSGE "sge") From 8db6dc53b0b03c7b6addea4cfd89b591678caa8d Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 7 Aug 2024 18:57:20 +0300 Subject: [PATCH 12/12] openmpi: fix postInstall hook on Darwin --- pkgs/development/libraries/openmpi/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix index a70e3ce787d7..79afcbff17c4 100644 --- a/pkgs/development/libraries/openmpi/default.nix +++ b/pkgs/development/libraries/openmpi/default.nix @@ -212,7 +212,12 @@ stdenv.mkDerivation (finalAttrs: { ${lib.pipe wrapperDataFileNames [ (lib.mapCartesianProduct ( { part1, part2 }: - '' + # From some reason the Darwin build doesn't include some of these + # wrapperDataSubstitutions strings and even some of the files. Hence + # we currently don't perform these substitutions on other platforms, + # until a Darwin user will care enough about this cross platform + # related substitution. + lib.optionalString stdenv.isLinux '' substituteInPlace "''${!outputDev}/share/openmpi/${part1}${part2}-wrapper-data.txt" \ --replace-fail \ compiler=${lib.elemAt wrapperDataSubstitutions.${part2} 0} \