nixpkgs/pkgs/by-name/sy/sympow/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

86 lines
2.3 KiB
Nix

{
lib,
stdenv,
fetchFromGitLab,
makeWrapper,
which,
autoconf,
help2man,
file,
pari,
}:
stdenv.mkDerivation rec {
version = "2.023.7";
pname = "sympow";
src = fetchFromGitLab {
group = "rezozer";
owner = "forks";
repo = "sympow";
rev = "v${version}";
hash = "sha256-sex8gRiBdTcVMV3nSeiTYamAjPoXQdiiZwjRmeKA+mc=";
};
patches = [ ./clean-extra-logfile-output-from-pari.patch ];
postUnpack = ''
patchShebangs .
'';
nativeBuildInputs = [
makeWrapper
which
autoconf
help2man
file
pari
];
configurePhase = ''
runHook preConfigure
export PREFIX="$out"
export VARPREFIX="$out" # see comment on postInstall
./Configure # doesn't take any options
runHook postConfigure
'';
# Usually, sympow has 3 levels of caching: statically distributed in /usr/,
# shared in /var and per-user in ~/.sympow. The shared cache assumes trust in
# other users and a shared /var is not compatible with nix's approach, so we
# set VARPREFIX to the read-only $out. This effectively disables shared
# caching. See https://trac.sagemath.org/ticket/3360#comment:36 and sympow's
# README for more details on caching.
# sympow will complain at runtime about the lack of write-permissions on the
# shared cache. We pass the `-quiet` flag by default to disable this.
postInstall = ''
wrapProgram "$out/bin/sympow" --add-flags '-quiet'
'';
# Example from the README as a sanity check.
doInstallCheck = true;
installCheckPhase =
''
export HOME=$TMPDIR
"$out/bin/sympow" -curve "[1,2,3,4,5]" -moddeg | grep 'Modular Degree is 464'
echo "[1,-1,0,-79,289]" | "$out/bin/sympow" -analrank | grep ^"Analytic Rank is 4"
"$out/bin/sympow" -curve "[1,-1,0,-79,289]" -analrank | grep ^"Analytic Rank is 4"
"$out/bin/sympow" -curve "[0,1,1,-2,0]" -analrank | grep ^"Analytic Rank is 2"
''
+ lib.optionalString (!stdenv.hostPlatform.isAarch64) ''
"$out/bin/sympow" -sp 2p16 -curve "[1,2,3,4,5]" | grep '8.3705'
'';
meta = {
description = "Compute special values of symmetric power elliptic curve L-functions";
mainProgram = "sympow";
license = {
shortName = "sympow";
fullName = "Custom, BSD-like. See COPYING file.";
free = true;
};
maintainers = lib.teams.sage.members;
platforms = lib.platforms.unix;
};
}