From 7264bbf85b2f4e63f74b3cb3e7ce50ed661252bb Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sun, 14 Jul 2024 14:01:52 +0200 Subject: [PATCH 1/4] h5dump: use finalAttrs, hash instead of sha256, remove with lib --- pkgs/tools/misc/h5utils/default.nix | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pkgs/tools/misc/h5utils/default.nix b/pkgs/tools/misc/h5utils/default.nix index 90f9b48dd118..917313a0cb4f 100644 --- a/pkgs/tools/misc/h5utils/default.nix +++ b/pkgs/tools/misc/h5utils/default.nix @@ -4,15 +4,15 @@ , libmatheval ? null }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { version = "1.13.2"; pname = "h5utils"; # fetchurl is used instead of fetchFromGitHub because the git repo version requires # additional tools to build compared to the tarball release; see the README for details. src = fetchurl { - url = "https://github.com/stevengj/h5utils/releases/download/${version}/h5utils-${version}.tar.gz"; - sha256 = "sha256-7qeFWoI1+st8RU5hEDCY5VZY2g3fS23luCqZLl8CQ1E="; + url = "https://github.com/stevengj/h5utils/releases/download/${finalAttrs.version}/h5utils-${finalAttrs.version}.tar.gz"; + hash = "sha256-7qeFWoI1+st8RU5hEDCY5VZY2g3fS23luCqZLl8CQ1E="; }; # libdf is an alternative name for libhdf (hdf4) @@ -22,18 +22,17 @@ stdenv.mkDerivation rec { --replace "-ldf" "-lhdf" \ ''; - preBuild = lib.optionalString hdf5.mpiSupport "export CC=${hdf5.mpi}/bin/mpicc"; + preBuild = lib.optionalString hdf5.mpiSupport "export CC=${lib.getBin hdf5.mpi}/mpicc"; - buildInputs = with lib; [ hdf5 libjpeg libpng ] ++ optional hdf5.mpiSupport hdf5.mpi - ++ optional (hdf4 != null) hdf4 - ++ optional (libmatheval != null) libmatheval; + buildInputs = [ hdf5 libjpeg libpng ] ++ lib.optional hdf5.mpiSupport hdf5.mpi + ++ lib.optional (hdf4 != null) hdf4 + ++ lib.optional (libmatheval != null) libmatheval; meta = with lib; { description = "Set of utilities for visualization and conversion of scientific data in the free, portable HDF5 format"; homepage = "https://github.com/stevengj/h5utils"; - changelog = "https://github.com/NanoComp/h5utils/releases/tag/${version}"; + changelog = "https://github.com/NanoComp/h5utils/releases/tag/${finalAttrs.version}"; license = with licenses; [ mit gpl2Plus ]; maintainers = with maintainers; [ sfrijters ]; }; - -} +}) From ba942e865e538394bee682e694e35aa3eb246af7 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sun, 14 Jul 2024 14:02:41 +0200 Subject: [PATCH 2/4] h5utils: reformat for RFC166 --- pkgs/tools/misc/h5utils/default.nix | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/misc/h5utils/default.nix b/pkgs/tools/misc/h5utils/default.nix index 917313a0cb4f..41f23dda2a42 100644 --- a/pkgs/tools/misc/h5utils/default.nix +++ b/pkgs/tools/misc/h5utils/default.nix @@ -1,7 +1,12 @@ -{ stdenv, fetchurl, lib -, hdf5, libpng, libjpeg -, hdf4 ? null -, libmatheval ? null +{ + stdenv, + fetchurl, + lib, + hdf5, + libpng, + libjpeg, + hdf4 ? null, + libmatheval ? null, }: stdenv.mkDerivation (finalAttrs: { @@ -16,15 +21,20 @@ stdenv.mkDerivation (finalAttrs: { }; # libdf is an alternative name for libhdf (hdf4) - preConfigure = lib.optionalString (hdf4 != null) - '' + preConfigure = lib.optionalString (hdf4 != null) '' substituteInPlace configure \ --replace "-ldf" "-lhdf" \ ''; preBuild = lib.optionalString hdf5.mpiSupport "export CC=${lib.getBin hdf5.mpi}/mpicc"; - buildInputs = [ hdf5 libjpeg libpng ] ++ lib.optional hdf5.mpiSupport hdf5.mpi + buildInputs = + [ + hdf5 + libjpeg + libpng + ] + ++ lib.optional hdf5.mpiSupport hdf5.mpi ++ lib.optional (hdf4 != null) hdf4 ++ lib.optional (libmatheval != null) libmatheval; @@ -32,7 +42,10 @@ stdenv.mkDerivation (finalAttrs: { description = "Set of utilities for visualization and conversion of scientific data in the free, portable HDF5 format"; homepage = "https://github.com/stevengj/h5utils"; changelog = "https://github.com/NanoComp/h5utils/releases/tag/${finalAttrs.version}"; - license = with licenses; [ mit gpl2Plus ]; + license = with licenses; [ + mit + gpl2Plus + ]; maintainers = with maintainers; [ sfrijters ]; }; }) From 9aaab7493ca32c55fc61028df137c8cd68985855 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sun, 14 Jul 2024 14:04:12 +0200 Subject: [PATCH 3/4] h5utils: move to by-name --- .../h5utils/default.nix => by-name/h5/h5utils/package.nix} | 0 pkgs/top-level/all-packages.nix | 5 ----- 2 files changed, 5 deletions(-) rename pkgs/{tools/misc/h5utils/default.nix => by-name/h5/h5utils/package.nix} (100%) diff --git a/pkgs/tools/misc/h5utils/default.nix b/pkgs/by-name/h5/h5utils/package.nix similarity index 100% rename from pkgs/tools/misc/h5utils/default.nix rename to pkgs/by-name/h5/h5utils/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e74e5060f2e7..696dc1d6cada 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8709,11 +8709,6 @@ with pkgs; h2 = callPackage ../servers/h2 { }; - h5utils = callPackage ../tools/misc/h5utils { - libmatheval = null; - hdf4 = null; - }; - haproxy = callPackage ../tools/networking/haproxy { }; hackertyper = callPackage ../tools/misc/hackertyper { }; From 4a965c5df18e481dca59d0b4ce38c3dd217c6140 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sun, 14 Jul 2024 14:09:56 +0200 Subject: [PATCH 4/4] h5utils: remove more 'with lib' --- pkgs/by-name/h5/h5utils/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/h5/h5utils/package.nix b/pkgs/by-name/h5/h5utils/package.nix index 41f23dda2a42..3c93a3f2a407 100644 --- a/pkgs/by-name/h5/h5utils/package.nix +++ b/pkgs/by-name/h5/h5utils/package.nix @@ -38,14 +38,14 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optional (hdf4 != null) hdf4 ++ lib.optional (libmatheval != null) libmatheval; - meta = with lib; { + meta = { description = "Set of utilities for visualization and conversion of scientific data in the free, portable HDF5 format"; homepage = "https://github.com/stevengj/h5utils"; changelog = "https://github.com/NanoComp/h5utils/releases/tag/${finalAttrs.version}"; - license = with licenses; [ + license = with lib.licenses; [ mit gpl2Plus ]; - maintainers = with maintainers; [ sfrijters ]; + maintainers = [ lib.maintainers.sfrijters ]; }; })