11 # - "minimal" (~400M):
12 # Install the bare minimum of packages required by gap to start.
13 # This is likely to break a lot of stuff. Do not expect upstream support with
15 # - "standard" (~700M):
16 # Install the "standard packages" which gap autoloads by default. These
17 # packages are effectively considered a part of gap.
19 # Install all available packages. This takes a lot of space.
20 , packageSet ? "standard"
21 # Kept for backwards compatibility. Overrides packageSet to "full".
22 , keepAllPackages ? false
25 # packages absolutely required for gap to start
26 # `*` represents the version where applicable
33 # packages autoloaded by default if available, and their dependencies
34 autoloadedPackages = [
49 "autodoc" # dependency of atlasrep
50 "io" # used by atlasrep to fetch data from online sources
51 "radiroot" # dependency of polenta
52 "utils" # dependency of atlasrep
54 keepAll = keepAllPackages || (packageSet == "full");
55 packagesToKeep = requiredPackages ++ lib.optionals (packageSet == "standard") autoloadedPackages;
57 # Generate bash script that removes all packages from the `pkg` subdirectory
58 # that are not on the whitelist. The whitelist consists of strings expected by
60 removeNonWhitelistedPkgs = whitelist: ''
61 find pkg -type d -maxdepth 1 -mindepth 1 \
62 '' + (lib.concatStringsSep "\n" (map (str: "-not -name '${str}' \\") whitelist)) + ''
63 -exec echo "Removing package {}" \; \
67 stdenv.mkDerivation rec {
69 # https://www.gap-system.org/Releases/
73 url = "https://github.com/gap-system/gap/releases/download/v${version}/gap-${version}.tar.gz";
74 sha256 = "sha256-ZyMIdF63iiIklO6N1nhu3VvDMUVvzGRWrAZL2yjVh6g=";
79 url = "https://github.com/gap-system/gap/commit/c786e229413a44b7462196716b99ae9bb0071f4c.patch";
80 hash = "sha256-g3jrEMSavHAUKlHoPqWmOw49hWHU+29SA788Klnr0Uw=";
84 # remove all non-essential packages (which take up a lot of space)
85 preConfigure = lib.optionalString (!keepAll) (removeNonWhitelistedPkgs packagesToKeep) + ''
99 propagatedBuildInputs = [
100 pari # used at runtime by the alnuth package
103 # "teststandard" is a superset of the tests run by "check". it takes ~20min
104 # instead of ~1min. tests are run twice, once with all packages loaded and
106 # installCheckTarget = "teststandard";
108 doInstallCheck = true;
109 installCheckTarget = "check";
112 # gap tests check that the home directory exists
113 export HOME="$TMP/gap-home"
116 # make sure gap is in PATH
117 export PATH="$out/bin:$PATH"
119 # make sure we don't accidentally use the wrong gap binary
122 # like the defaults the Makefile, but use gap from PATH instead of the
124 installCheckFlagsArray+=(
125 "TESTGAPcore=gap --quitonbreak -b -q -r"
126 "TESTGAPauto=gap --quitonbreak -b -q -r -m 100m -o 1g -x 80"
127 "TESTGAP=gap --quitonbreak -b -q -r -m 100m -o 1g -x 80 -A"
133 # failures are ignored unless --strict is set
134 bash ../bin/BuildPackages.sh ${lib.optionalString (!keepAll) "--strict"}
139 # make install creates an empty pkg dir. since we run "make check" on
140 # installCheckPhase to make sure the installed GAP finds its libraries, we
141 # also install the tst dir. this is probably excessively cautious, see
142 # https://github.com/NixOS/nixpkgs/pull/192548#discussion_r992824942
143 rm -r "$out/share/gap/pkg"
144 cp -ar pkg tst "$out/share/gap"
148 # patchelf won't strip references to the build dir if it still exists
153 description = "Computational discrete algebra system";
154 # We are also grateful to ChrisJefferson for previous work on the package,
155 # and to ChrisJefferson and fingolfin for help with GAP-related questions
156 # from the upstream point of view.
157 maintainers = teams.sage.members;
158 platforms = platforms.all;
159 # keeping all packages increases the package size considerably, which is
160 # why a local build is preferable in that situation. The timeframe is
161 # reasonable and that way the binary cache doesn't get overloaded.
162 hydraPlatforms = lib.optionals (!keepAllPackages) meta.platforms;
163 license = licenses.gpl2;
164 homepage = "https://www.gap-system.org";