From 41cbe1fe27244a26567012f9aa367ff8c16f113e Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:15:07 +0100 Subject: [PATCH] gurobi: 11.0.3 -> 12.0.0 --- pkgs/by-name/gu/gurobi/package.nix | 38 +++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/gu/gurobi/package.nix b/pkgs/by-name/gu/gurobi/package.nix index 0a6374907e57..4d7afdb86083 100644 --- a/pkgs/by-name/gu/gurobi/package.nix +++ b/pkgs/by-name/gu/gurobi/package.nix @@ -6,16 +6,29 @@ python3, }: +let + platform = + { + aarch64-linux = "armlinux64"; + x86_64-linux = "linux64"; + } + .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); +in stdenv.mkDerivation rec { pname = "gurobi"; - version = "11.0.3"; + version = "12.0.0"; src = fetchurl { - url = "https://packages.gurobi.com/${lib.versions.majorMinor version}/gurobi${version}_linux64.tar.gz"; - hash = "sha256-gqLIZxwjS7qp3GTaIrGVGr9BxiBH/fdwBOZfJKkd/RM="; + url = "https://packages.gurobi.com/${lib.versions.majorMinor version}/gurobi${version}_${platform}.tar.gz"; + hash = + { + aarch64-linux = "sha256-jhICy/CGahb6eMPkvg+jKIjskS+N3zM8KVYdBXlk74Y="; + x86_64-linux = "sha256-or3Jwda/jrTlUaGErxzo17BDXqjn0ZoBfMfVP9Xv2hI="; + } + .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); }; - sourceRoot = "gurobi${builtins.replaceStrings [ "." ] [ "" ] version}/linux64"; + sourceRoot = "gurobi${builtins.replaceStrings [ "." ] [ "" ] version}/${platform}"; nativeBuildInputs = [ autoPatchelfHook @@ -32,6 +45,8 @@ stdenv.mkDerivation rec { makeFlags = [ "--directory=src/build" ]; installPhase = '' + runHook preInstall + mkdir -p $out/bin cp bin/* $out/bin/ rm $out/bin/gurobi.sh @@ -52,19 +67,24 @@ stdenv.mkDerivation rec { mkdir -p $out/share/java ln -s $out/lib/gurobi.jar $out/share/java/ ln -s $out/lib/gurobi-javadoc.jar $out/share/java/ + + runHook postInstall ''; passthru.libSuffix = lib.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor version); - meta = with lib; { + meta = { description = "Optimization solver for mathematical programming"; homepage = "https://www.gurobi.com"; - sourceProvenance = with sourceTypes; [ + sourceProvenance = with lib.sourceTypes; [ binaryBytecode binaryNativeCode ]; - license = licenses.unfree; - platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ wegank ]; + license = lib.licenses.unfree; + platforms = [ + "aarch64-linux" + "x86_64-linux" + ]; + maintainers = with lib.maintainers; [ wegank ]; }; }