sawfish has a hard dependency on GTK 2, which is being removed from
Nixpkgs. there has been an issue about a GTK 3 port since 2022
(https://github.com/SawfishWM/sawfish/issues/51) with no response. it
appears to be effectively in maintenance mode upstream so this appears
unlikely to change.
Copy Darwin-specific env var following the upstream `./src/bin/sage-env` code. This change helps
`ext_rep.py` doctests pass on Darwin. For historical reasons the Nix packaging rewrites upstream
`sage-env` completely so it does not automatically inherit these workarounds.
Also migrates away from them with these commands, using ast-grep 0.43.0
with these commands in bash (assisted by ChatGPT):
```bash
for old in extractType1 extractType2; do
ast-grep \
--lang nix \
--pattern "\$TOOLS.$old" \
--rewrite '$TOOLS.extract' \
--update-all \
pkgs
done
ast-grep \
--lang nix \
--pattern '$TOOLS.wrapType1' \
--rewrite '$TOOLS.wrapType2' \
--update-all \
pkgs
```
Assisted-by: GPT-5.6-Sol Medium via ChatGPT
After #541155 disabled `ntl` threading on Darwin to bypass a compilation failure, the sage tests started
failing with segfaults caused by with-threading and without-threading `ntl` assumptions present in the
graph of libraries installed by the build.
While it is possible to work out a correct darwin build using without-threading `ntl`, this change
instead makes the threaded version work on darwin by minimally patching upstream to ensure the linker
gets to reference this library directly during compilation.
With these change the tests now pass.
This change fixes `nix build .#sage`. The regression is due to a new check, pythonMetadataCheckHook,
introduced in #532778; the check enforces that pname matches the metadata name of the underlying Python
project being built, typically in pyproject.toml; in this case the underlying name is "sagemath".