From caeb363b1c4886d7a18d711ac7c14c52c9e3da11 Mon Sep 17 00:00:00 2001 From: Guy Chronister Date: Wed, 8 Jul 2026 19:06:55 -0500 Subject: [PATCH 1/2] megam: migrate to ocaml-ng 4.14 and modernize build - Switch from `ocaml` to `ocaml-ng.ocamlPackages_4_14` and inherit `ocaml` directly inside the derivation. - Update `src` to use `hash` instead of deprecated `sha256`. - Replace deprecated OCaml APIs using `--replace-fail` to ensure failures surface during patching. - Enable `__structuredAttrs` for consistency with current package style. - Remove redundant override in all-packages.nix now that the derivation selects the OCaml version internally. --- pkgs/applications/science/misc/megam/default.nix | 15 ++++++++++----- pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/science/misc/megam/default.nix b/pkgs/applications/science/misc/megam/default.nix index 614b4935a644..53f1760943a0 100644 --- a/pkgs/applications/science/misc/megam/default.nix +++ b/pkgs/applications/science/misc/megam/default.nix @@ -2,17 +2,21 @@ lib, stdenv, fetchurl, - ocaml, + ocaml-ng, ncurses, }: +let + inherit (ocaml-ng.ocamlPackages_4_14) ocaml; +in + stdenv.mkDerivation { pname = "megam"; version = "0.92"; src = fetchurl { url = "http://hal3.name/megam/megam_src.tgz"; - sha256 = "dc0e9f59ff8513449fe3bd40b260141f89c88a4edf6ddc8b8a394c758e49724e"; + hash = "sha256-3A6fWf+FE0Sf471AsmAUH4nIik7fbdyLijlMdY5Jck4="; }; patches = [ @@ -23,12 +27,13 @@ stdenv.mkDerivation { postPatch = '' # Deprecated in ocaml 3.10 https://github.com/ocaml/ocaml/commit/f6190f3d0c49c5220d443ee8d03ca5072d68aa87 # Deprecated in ocaml 3.08 https://github.com/ocaml/ocaml/commit/0c7aecb88dc696f66f49f3bed54a037361a26b8d - substituteInPlace fastdot_c.c --replace copy_double caml_copy_double --replace Bigarray_val Caml_ba_array_val --replace caml_bigarray caml_ba_array + substituteInPlace fastdot_c.c --replace-fail copy_double caml_copy_double --replace-fail Bigarray_val Caml_ba_array_val --replace-fail caml_bigarray caml_ba_array # They were already deprecated in 3.12 https://v2.ocaml.org/releases/3.12/htmlman/libref/Array.html - substituteInPlace abffs.ml main.ml --replace create_matrix make_matrix - substituteInPlace intHashtbl.ml --replace Array.create Array.make + substituteInPlace abffs.ml main.ml --replace-fail create_matrix make_matrix + substituteInPlace intHashtbl.ml --replace-fail Array.create Array.make ''; strictDeps = true; + __structuredAttrs = true; nativeBuildInputs = [ ocaml ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 07a3a5087eec..65d5ae575b6a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10633,9 +10633,7 @@ with pkgs; cudaSupport = true; }; - megam = callPackage ../applications/science/misc/megam { - inherit (ocaml-ng.ocamlPackages_4_14) ocaml; - }; + megam = callPackage ../applications/science/misc/megam { }; spyder = with python3.pkgs; toPythonApplication spyder; From 03e576ffb97a3ff559e9bed49d3aa54314778e02 Mon Sep 17 00:00:00 2001 From: Guy Chronister Date: Wed, 8 Jul 2026 19:10:08 -0500 Subject: [PATCH 2/2] megam: migrate to pkgs/by-name --- .../science/misc => by-name/me}/megam/ocaml-3.12.patch | 0 .../science/misc => by-name/me}/megam/ocaml-includes.patch | 0 .../misc/megam/default.nix => by-name/me/megam/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 4 files changed, 2 deletions(-) rename pkgs/{applications/science/misc => by-name/me}/megam/ocaml-3.12.patch (100%) rename pkgs/{applications/science/misc => by-name/me}/megam/ocaml-includes.patch (100%) rename pkgs/{applications/science/misc/megam/default.nix => by-name/me/megam/package.nix} (100%) diff --git a/pkgs/applications/science/misc/megam/ocaml-3.12.patch b/pkgs/by-name/me/megam/ocaml-3.12.patch similarity index 100% rename from pkgs/applications/science/misc/megam/ocaml-3.12.patch rename to pkgs/by-name/me/megam/ocaml-3.12.patch diff --git a/pkgs/applications/science/misc/megam/ocaml-includes.patch b/pkgs/by-name/me/megam/ocaml-includes.patch similarity index 100% rename from pkgs/applications/science/misc/megam/ocaml-includes.patch rename to pkgs/by-name/me/megam/ocaml-includes.patch diff --git a/pkgs/applications/science/misc/megam/default.nix b/pkgs/by-name/me/megam/package.nix similarity index 100% rename from pkgs/applications/science/misc/megam/default.nix rename to pkgs/by-name/me/megam/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 65d5ae575b6a..8e2620988152 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10633,8 +10633,6 @@ with pkgs; cudaSupport = true; }; - megam = callPackage ../applications/science/misc/megam { }; - spyder = with python3.pkgs; toPythonApplication spyder; ### SCIENCE / PHYSICS