anchor.diff:  
       mkdir -p "$out/bin" "$out/share/gap/"
   
  -    mkdir -p "$out/share/gap"
       echo "Copying files to target directory"
       cp -ar . "$out/share/gap/build-dir"
   
  
positive.code: stdenv.mkDerivation rec {
    pname = "gap";
    # https://www.gap-system.org/Releases/
    version = "4.10.2";
  
    src = fetchurl {
      url = "https://files.gap-system.org/gap-${lib.versions.major version}.${lib.versions.minor version}/tar.bz2/gap-${version}.tar.bz2";
      sha256 = "0cp6ddk0469zzv1m1vair6gm27ic6c5m77ri8rn0znq3gaps6x94";
    };
  
    # remove all non-essential packages (which take up a lot of space)
  
negative.code:   ];
  
    patches = [
      # Fix for locale specific tests causing issues. Already upstream.
      # Backport of https://github.com/gap-system/gap/pull/4022
      (fetchpatch {
        name = "remove-locale-specific-tests.patch";
        url = "https://github.com/gap-system/gap/commit/c18b0c4215b5212a2cc4f305e2d5b94ba716bee8.patch";
        sha256 = "sha256-De+T9Y7ewRT6plJrj2VR8axRvD/JCTYKOBWB7Bw0oq0=";
      })
  
      # fixes aarch64 gc crashes: https://github.com/gap-system/gap/pull/3965
      (fetchpatch {
        name = "mark-genstackfuncbags-as-noinline.patch";
        url = "https://github.com/gap-system/gap/commit/f0a8f49ff8dad0a5fa77253d45457c6f40f96778.patch";
        sha256 = "sha256-GU9tOP1stX2vn8m8kXOBupEpxIYArA76ibKL8eLn0MY=";
      })
    ];
  
    # "teststandard" is a superset of testinstall. It takes ~1h instead of ~1min.
    # tests are run twice, once with all packages loaded and once without
  