From 7442533bf1bda4d21ff8abeec6b4d6f0f2deffa5 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Fri, 25 Feb 2022 21:14:22 +0100 Subject: [PATCH 1/2] sage: support adding extra Python packages to environment mysage = sage.override { extraPythonPackages = ps: with ps; [ dask ]; }; Note that the sage-tests are executed again as well, which is not very nice. --- pkgs/applications/science/math/sage/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix index 2066087692a0..4909deca2c6e 100644 --- a/pkgs/applications/science/math/sage/default.nix +++ b/pkgs/applications/science/math/sage/default.nix @@ -1,5 +1,6 @@ { pkgs , withDoc ? false +, extraPythonPackages ? ps: [] }: # Here sage and its dependencies are put together. Some dependencies may be pinned @@ -109,7 +110,7 @@ let rpy2 sphinx pillow - ]; + ] ++ extraPythonPackages python3.pkgs; pythonEnv = python3.buildEnv.override { extraLibs = pythonRuntimeDeps; From 330d9344d2880aacca1f5bd330d46f6c014d9cb0 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Fri, 25 Feb 2022 21:24:38 +0100 Subject: [PATCH 2/2] sage: make it possible not to rebuild sage-tests Requiring sage-tests as build input just so it gets build is a bit unfortunatey but understandable. This commit introduces an option to not add sage-tests as a dependency. This is preferred in case e.g. Python packages are added to the environment. --- pkgs/applications/science/math/sage/default.nix | 3 ++- pkgs/applications/science/math/sage/sage.nix | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix index 4909deca2c6e..70e24e2608d0 100644 --- a/pkgs/applications/science/math/sage/default.nix +++ b/pkgs/applications/science/math/sage/default.nix @@ -1,5 +1,6 @@ { pkgs , withDoc ? false +, requireSageTests ? true , extraPythonPackages ? ps: [] }: @@ -167,5 +168,5 @@ in # A wrapper around sage that makes sure sage finds its docs (if they were build). callPackage ./sage.nix { inherit sage-tests sage-with-env sagedoc jupyter-kernel-definition; - inherit withDoc; + inherit withDoc requireSageTests; } diff --git a/pkgs/applications/science/math/sage/sage.nix b/pkgs/applications/science/math/sage/sage.nix index 5805a5c7b0c7..96122fba5ab4 100644 --- a/pkgs/applications/science/math/sage/sage.nix +++ b/pkgs/applications/science/math/sage/sage.nix @@ -6,6 +6,7 @@ , jupyter-kernel , sagedoc , withDoc +, requireSageTests }: # A wrapper that makes sure sage finds its docs (if they were build) and the @@ -26,7 +27,7 @@ stdenv.mkDerivation rec { buildInputs = [ makeWrapper - + ] ++ lib.optionals requireSageTests [ # This is a hack to make sure sage-tests is evaluated. It doesn't acutally # produce anything of value, it just decouples the tests from the build. sage-tests