1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 23:20:55 +00:00
nixpkgs/pkgs/applications/science/math/sage
Timo Kaufmann 8ac53ed0b1 python.pkgs.sympy: 1.4 -> 1.5
Sage needs some doctest changes. The patch was included upstream.
Modelled after https://trac.sagemath.org/ticket/28911.
2019-12-26 11:46:42 +01:00
..
patches sage: ignore werkzeug immutable dict deprecation 2019-11-06 14:40:13 +01:00
default.nix sage: 8.8.beta6 -> 8.8.beta7 2019-06-27 22:02:57 +02:00
dist-tests.nix sage: add list of past test failures 2019-08-02 18:09:18 +02:00
env-locations.nix sage: 8.6 -> 8.7 2019-04-17 22:44:32 +02:00
flask-oldsessions.nix treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
flask-openid.nix sage: 8.1 -> 8.2, use system packages 2018-06-30 01:21:31 +02:00
pybrial.nix pybrial: 1.2.3 -> 1.2.5, directly use the brial src 2019-12-13 20:29:16 +01:00
python-openid.nix sage: python-openid: move django and twill to checkInputs (#54949) 2019-01-31 10:14:36 +01:00
README.md sage: refactor 2018-11-24 23:14:33 +01:00
sage-env.nix sage: fix pkgconfig errors in tests 2019-11-06 14:40:13 +01:00
sage-src.nix python.pkgs.sympy: 1.4 -> 1.5 2019-12-26 11:46:42 +01:00
sage-tests.nix sage: disable test timeout 2019-12-01 13:23:54 +01:00
sage-with-env.nix treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
sage.nix treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
sagedoc.nix treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
sagelib.nix Merge remote-tracking branch 'upstream/master' into sage-8.9 2019-09-23 17:11:15 +02:00
sagenb.nix sage: ignore cmp deprecation in sagenb 2019-11-06 14:40:13 +01:00

Sage on nixos

Sage is a pretty complex package that depends on many other complex packages and patches some of those. As a result, the sage nix package is also quite complex.

Don't feel discouraged to fix, simplify or improve things though. The individual files have comments explaining their purpose. The most importent ones are default.nix linking everything together, sage-src.nix adding patches and sagelib.nix building the actual sage package.

The sage build is broken

First you should find out which change to nixpkgs is at fault (if you don't already know). You can use git-bisect for that (see the manpage).

If the build broke as a result of a package update, try those solutions in order:

  • search the sage trac for keywords like "Upgrade ". Maybe somebody has already proposed a patch that fixes the issue. You can then add a fetchpatch to sage-src.nix.

  • check if gentoo, debian or arch linux already solved the problem. You can then again add a fetchpatch to sage-src.nix. If applicable you should also propose the patch upstream.

  • fix the problem yourself. First clone the sagemath source and then check out the sage version you want to patch:

[user@localhost ~]$ git clone git://github.com/sagemath/sage.git
[user@localhost ~]$ cd sage
[user@localhost sage]$ git checkout 8.2 # substitute the relevant version here

Then make the needed changes and generate a patch with git diff:

[user@localhost ~]$ <make changes>
[user@localhost ~]$ git diff -u > /path/to/nixpkgs/pkgs/applications/science/math/sage/patches/name-of-patch.patch

Now just add the patch to sage-src.nix and test your changes. If they fix the problem, propose them upstream and add a link to the trac ticket.

  • pin the package version in default.nix and add a note that explains why that is necessary.

Proposing a sage patch

You can login the sage trac using GitHub. Your username will then be gh-<your-github-name>. The only other way is to request a trac account via email. After that refer to git the hard way in the sage documentation. The "easy way" requires a non-GitHub account (requested via email) and a special tool. The "hard way" is really not all that hard if you're a bit familiar with git.

Here's the gist, assuming you want to use ssh key authentication. First, add your public ssh key. Then:

[user@localhost ~]$ git clone git://github.com/sagemath/sage.git
[user@localhost ~]$ cd sage
[user@localhost sage]$ git remote add trac git@trac.sagemath.org:sage.git -t master
[user@localhost sage]$ git checkout -b u/gh-<your-github-username>/<your-branch-name> develop
[user@localhost sage]$ <make changes>
[user@localhost sage]$ git add .
[user@localhost sage]$ git commit
[user@localhost sage]$ git show # review your changes
[user@localhost sage]$ git push --set-upstream trac u/gh-<your-github-username>/<your-branch-name>

You now created a branch on the trac server (you must follow the naming scheme as you only have push access to branches with the u/gh-<your-github-username>/ prefix). Now you can create a new trac ticket.

  • Write a description of the change
  • set the type and component as appropriate
  • write your real name in the "Authors" field
  • write u/gh-<your-github-username>/<your-branch-name> in the "Branch" field
  • click "Create ticket"
  • click "Modify" on the top right of your ticket (for some reason you can only change the ticket status after you have created it)
  • set the ticket status from new to needs_review
  • click "Save changes"

Refer to sages Developer's Guide for further details.

I want to update sage

You'll need to change the version field in sage-src.nix. Afterwards just try to build and let nix tell you which patches no longer apply (hopefully because they were adopted upstream). Remove those.

Hopefully the build will succeed now. If it doesn't and the problem is obvious, fix it as described in The sage build is broken. If the problem is not obvious, you can try to first update sage to an intermediate version (remember that you can also set the version field to any git revision of sage) and locate the sage commit that introduced the issue. You can even use git-bisect for that (it will only be a bit tricky to keep track of which patches to apply). Hopefully after that the issue will be obvious.

Well, that didn't help!

If you couldn't fix the problem, create a GitHub issue on the nixpkgs repo and ping @timokau (or whoever is listed in the maintainers list of the sage package). Describe what you did and why it didn't work. Afterwards it would be great if you help the next guy out and improve this documentation!