diff --git a/pkgs/development/python-modules/cypari/default.nix b/pkgs/development/python-modules/cypari/default.nix index 72ffd4b50b59..7e96fde37fe6 100644 --- a/pkgs/development/python-modules/cypari/default.nix +++ b/pkgs/development/python-modules/cypari/default.nix @@ -3,29 +3,13 @@ python, buildPythonPackage, fetchFromGitHub, - fetchurl, setuptools, cython, - bash, + gmp, + pari, perl, - gnum4, - texliveBasic, }: -let - pariVersion = "2.15.4"; - gmpVersion = "6.3.0"; - - pariSrc = fetchurl { - url = "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${lib.versions.majorMinor pariVersion}/pari-${pariVersion}.tar.gz"; - hash = "sha256-w1Rb/uDG37QLd/tLurr5mdguYAabn20ovLbPAEyMXA8="; - }; - - gmpSrc = fetchurl { - url = "https://ftp.gnu.org/gnu/gmp/gmp-${gmpVersion}.tar.bz2"; - hash = "sha256-rCghGnz7YJuuLiyNYFjWbI/pZDT3QM9v4uR7AA0cIMs="; - }; -in buildPythonPackage rec { pname = "cypari"; version = "2.5.5"; @@ -39,13 +23,15 @@ buildPythonPackage rec { }; postPatch = '' - substituteInPlace ./setup.py \ - --replace-fail "/bin/bash" "${lib.getExe bash}" # final character is stripped from PARI error messages for some reason substituteInPlace ./cypari/handle_error.pyx \ --replace-fail "not a function in function call" "not a function in function cal" - ln -s ${pariSrc} ${pariSrc.name} - ln -s ${gmpSrc} ${gmpSrc.name} + ''; + + preBuild = '' + mkdir libcache + ln -s ${gmp} libcache/gmp + ln -s ${pari} libcache/pari ''; build-system = [ @@ -53,12 +39,8 @@ buildPythonPackage rec { cython ]; - NIX_LDFLAGS = "-lc"; - nativeBuildInputs = [ - gnum4 perl - texliveBasic ]; pythonImportsCheck = [ "cypari" ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 4703021f89a8..5227fcdcaa7c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3278,7 +3278,23 @@ self: super: with self; { cynthion = callPackage ../development/python-modules/cynthion { }; - cypari = callPackage ../development/python-modules/cypari { }; + cypari = callPackage ../development/python-modules/cypari { + + inherit (pkgs.pkgsStatic) gmp; + + pari = pkgs.pari.overrideAttrs rec { + version = "2.15.4"; + src = pkgs.fetchurl { + url = "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${lib.versions.majorMinor version}/pari-${version}.tar.gz"; + hash = "sha256-w1Rb/uDG37QLd/tLurr5mdguYAabn20ovLbPAEyMXA8="; + }; + installTargets = [ + "install" + "install-lib-sta" + ]; + }; + + }; cypari2 = callPackage ../development/python-modules/cypari2 { };