From 2e795a603c5803b2aa47a8fd87f8ea157ab5aa3d Mon Sep 17 00:00:00 2001 From: Diego Date: Mon, 16 Feb 2026 22:50:09 +0100 Subject: [PATCH] mlucas: init at 21.0.2 --- pkgs/by-name/ml/mlucas/package.nix | 76 ++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 pkgs/by-name/ml/mlucas/package.nix diff --git a/pkgs/by-name/ml/mlucas/package.nix b/pkgs/by-name/ml/mlucas/package.nix new file mode 100644 index 000000000000..4eeca3ea6eaf --- /dev/null +++ b/pkgs/by-name/ml/mlucas/package.nix @@ -0,0 +1,76 @@ +{ + lib, + stdenv, + fetchFromGitHub, + gmp, + versionCheckHook, +}: +let + + platform = if stdenv.hostPlatform.system == "aarch64-linux" then "asimd" else "avx2"; + +in +stdenv.mkDerivation (finalAttrs: { + pname = "mlucas"; + # A specific git commit is used because there are no official GitHub releases. + version = "21.0.2"; + + src = fetchFromGitHub { + owner = "primesearch"; + repo = "Mlucas"; + rev = "d082c2a00b42410d6d87605212c68be25f9f4d7d"; + hash = "sha256-YD2Kt8SD5sxZH8Em8jDZ1qSfIhgLUklOdkORmVR588o="; + }; + + enableParallelBuilding = true; + + buildInputs = [ + gmp + ]; + + postPatch = '' + chmod +x makemake.sh + patchShebangs makemake.sh + ''; + + env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; + + buildPhase = '' + runHook preBuild + + ./makemake.sh ${platform} + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + install -Dm755 obj_${platform}/Mlucas $out/bin/mlucas + + runHook postInstall + ''; + + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + + meta = { + description = "Open-source program for primality testing of Mersenne numbers"; + longDescription = '' + This program may be used to test any suitable number as you wish, but it is preferable that you do so in a coordinated fashion, + as part of the Great Internet Mersenne Prime Search (GIMPS). Note that on x86 processors Mlucas is not as efficient + as the main GIMPS client, George Woltman's Prime95 program (a.k.a. mprime for the linux version), + but that program is not 100% open-source. Prime95 is also only available for platforms based on the + x86 processor architecture. The help.txt file in the Github repo includes a variety of usage information + not covered in the original README. + ''; + homepage = "https://github.com/primesearch/Mlucas"; + maintainers = with lib.maintainers; [ dstremur ]; + license = lib.licenses.gpl3Only; + platforms = [ + "x86_64-linux" + "aarch64-linux" + ]; + mainProgram = "mlucas"; + }; +})