Subject: Add sage

From: Andreas Enge <[email-masked]>
Date: Thu, 13 Feb 2025 16:29:36 +0100

Hello!

The next two commits add SageMath as the package sage to Guix.

Sage uses maxima, but needs maxima compiled with the ecl common lisp
implementation, which I have added as a new package maxima-ecl in 
addition to our current maxima, which is compiled with sbcl.
Ideally, instead of adding this maxima-ecl, I would just have it
replace our current maxima - in this way, we would have only one
maxima package; both should have the same functionality anyway.
What do you think?

I have taken a lot of care to patch the scripts in the sage package so
that the references to external binaries become internal with the
complete paths /gnu/store/..., so that only few propagated inputs are
needed (essentially Python libraries).
>From inside sage, you can run %singular, %maxima, %gp or %gap to shell
out to these external computer algebra systems.

In my home profile, the REPL obtained by typing "sage" fails to start,
due to some mysterious conflict between, I suppose, propagated python
inputs pulled in through other packages. I could work around this by
   ./pre-inst-env guix shell -C --pure sage
and then running "sage" in the Guix shell.
The jupyter notebook is directly functional running "sage -n".

There are definitely lots of optional packages that could be added
as inputs in later steps. In that case, I would suggest that for each
new input we come up with a sage command that fails with the current
setup and succeeds with the enhanced setup, so as to "prove" that the
added inputs are indeed taken into account. (As an example, in a previous
iteration, I already had gmp-ecm as an input, but upon inspection it turned
out that it was not actually used to factor numbers using ECM, and I had to
add the
              (substitute* "src/sage/env.py"
                (("\"ecm\"")
                 (string-append "\"" #$gmp-ecm "/bin/ecm\""))
lines to the package.)

So far, I have only tried to compile on x86_64, where it succeeds.

I would suggest to replace our sbcl maxima package by the ebcl one,
and to push sage to master.

What do you think?

Andreas