{ fetchFromGitLab, lib, stdenv, # library deps ecm, gmp, hwloc, python3, sqlite, # runtime deps openssh, rsync, util-linux, coreutils, # build deps cmake, curl, inetutils, perl, makeBinaryWrapper, # options useArch ? "znver4", useTune ? "znver4", }: stdenv.mkDerivation rec { pname = "cado-nfs"; git-rev = "bb65fdf0aaee0cea5e2da368bb87651d35d02603"; version = builtins.substring 0 7 git-rev; src = fetchFromGitLab { domain = "gitlab.inria.fr"; owner = pname; repo = pname; rev = git-rev; hash = "sha256-Ao8nX9rZ0ky7MK5qXGgMe4N160sPN/En6h/YdeI2/JU="; }; patches = [ ./0001-use-PATH-lookup-for-non-cado-programs.patch ]; buildInputs = [ gmp ecm python3 sqlite hwloc ]; nativeBuildInputs = [ cmake inetutils curl perl makeBinaryWrapper ]; NIX_CFLAGS_COMPILE = "-Wno-stringop-overflow" + (lib.optionalString (useArch != null) " -march=${useArch}") + (lib.optionalString (useTune != null) " -mtune=${useTune}"); postPatch = '' patchShebangs --build . ''; postConfigure = '' patchShebangs --build . ''; cadoBinPath = lib.makeBinPath [ openssh rsync util-linux coreutils ]; postInstall = '' wrapProgram $out/bin/cado-nfs-client.py \ --prefix PATH : ${cadoBinPath} wrapProgram $out/bin/cado-nfs.py \ --prefix PATH : ${cadoBinPath} ''; meta = { description = "Cado-NFS, An Implementation of the Number Field Sieve Algorithm"; longDescription = '' CADO-NFS is a complete implementation in C/C++ of the Number Field Sieve (NFS) algorithm for factoring integers and computing discrete logarithms in finite fields. It consists in various programs corresponding to all the phases of the algorithm, and a general script that runs them, possibly in parallel over a network of computers. ''; homepage = "https://cado-nfs.gitlabpages.inria.fr/"; license = lib.licenses.lgpl21Plus; maintainers = []; mainProgram = "cado-nfs.py"; platforms = lib.platforms.all; }; }