gap: add packageSet option
Two reasons for this: - more fine-grained space/functionality tradeoff - preparation for the sage 8.6 update, which finally doesn't need a downgraded gap anymore but does break when unexpected (non-standard) packages are installed. Details: https://trac.sagemath.org/ticket/26983 The proper way to deal with gap packages would be to create a package set, package each one individually and have something like gap equivalent of `python.withPackages`. I am not willing to do that however.
This commit is contained in:
parent
bb173ec8e3
commit
cf63a8c94c
@ -5,11 +5,60 @@
|
||||
, makeWrapper
|
||||
, m4
|
||||
, gmp
|
||||
# don't remove any packages -- results in a ~1.3G size increase
|
||||
# see https://github.com/NixOS/nixpkgs/pull/38754 for a discussion
|
||||
, keepAllPackages ? true
|
||||
# one of
|
||||
# - "minimal" (~400M):
|
||||
# Install the bare minimum of packages required by gap to start.
|
||||
# This is likely to break a lot of stuff. Do not expect upstream support with
|
||||
# this configuration.
|
||||
# - "standard" (~700M):
|
||||
# Install the "standard packages" which gap autoloads by default. These
|
||||
# packages are effectively considered a part of gap.
|
||||
# - "full" (~1.7G):
|
||||
# Install all available packages. This takes a lot of space.
|
||||
, packageSet ? "standard"
|
||||
# Kept for backwards compatibility. Overrides packageSet to "full".
|
||||
, keepAllPackages ? false
|
||||
}:
|
||||
let
|
||||
# packages absolutely required for gap to start
|
||||
# `*` represents the version where applicable
|
||||
requiredPackages = [
|
||||
"GAPDoc-*"
|
||||
"primgrp-*"
|
||||
"SmallGrp-*"
|
||||
"transgrp"
|
||||
];
|
||||
# packages autoloaded by default if available
|
||||
autoloadedPackages = [
|
||||
"atlasrep"
|
||||
"autpgrp-*"
|
||||
"alnuth-*"
|
||||
"crisp-*"
|
||||
"ctbllib"
|
||||
"FactInt-*"
|
||||
"fga"
|
||||
"irredsol-*"
|
||||
"laguna-*"
|
||||
"polenta-*"
|
||||
"polycyclic-*"
|
||||
"resclasses-*"
|
||||
"sophus-*"
|
||||
"tomlib-*"
|
||||
];
|
||||
standardPackages = requiredPackages ++ autoloadedPackages;
|
||||
keepAll = keepAllPackages || (packageSet == "full");
|
||||
packagesToKeep = requiredPackages ++ lib.optionals (packageSet == "standard") autoloadedPackages;
|
||||
|
||||
# Generate bash script that removes all packages from the `pkg` subdirectory
|
||||
# that are not on the whitelist. The whitelist consists of strings expected by
|
||||
# `find`'s `-name`.
|
||||
removeNonWhitelistedPkgs = whitelist: ''
|
||||
find pkg -type d -maxdepth 1 -mindepth 1 \
|
||||
'' + (lib.concatStringsSep "\n" (map (str: "-not -name '${str}' \\") whitelist)) + ''
|
||||
-exec echo "Removing package {}" \; \
|
||||
-exec rm -r '{}' \;
|
||||
'';
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "gap";
|
||||
# https://www.gap-system.org/Releases/
|
||||
@ -21,14 +70,8 @@ stdenv.mkDerivation rec {
|
||||
};
|
||||
|
||||
# remove all non-essential packages (which take up a lot of space)
|
||||
preConfigure = ''
|
||||
preConfigure = lib.optionalString (!keepAll) (removeNonWhitelistedPkgs packagesToKeep) + ''
|
||||
patchShebangs .
|
||||
'' + lib.optionalString (!keepAllPackages) ''
|
||||
find pkg -type d -maxdepth 1 -mindepth 1 \
|
||||
-not -name 'GAPDoc-*' \
|
||||
-not -name 'autpgrp*' \
|
||||
-exec echo "Removing package {}" \; \
|
||||
-exec rm -r {} \;
|
||||
'';
|
||||
|
||||
configureFlags = [ "--with-gmp=system" ];
|
||||
|
@ -22003,7 +22003,9 @@ in
|
||||
|
||||
gap = callPackage ../applications/science/math/gap { };
|
||||
|
||||
gap-minimal = lowPrio (gap.override { keepAllPackages = false; });
|
||||
gap-minimal = lowPrio (gap.override { packageSet = "minimal"; });
|
||||
|
||||
gap-full = lowPrio (gap.override { packageSet = "full"; });
|
||||
|
||||
geogebra = callPackage ../applications/science/math/geogebra { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user