anchor.diff:  , installManPages ? true
     # Specify binaries to build in the form { foo.src = "src/foo.cr"; }
     # The default `crystal build` options can be overridden with { foo.options = [ "--no-debug" ]; }
  -, crystalBinaries ? { }, ... }@args:
  +, crystalBinaries ? { }
  +, ...
  +}@args:
   
   assert (builtins.elem format [ "make" "crystal" "shards" ]);
  -
   let
     mkDerivationArgs = builtins.removeAttrs args [
       "format"
  
positive.code: { stdenv, lib, crystal, shards, git, pkgconfig, which, linkFarm, fetchFromGitHub, installShellFiles }:
  
  { # Some projects do not include a lock file, so you can pass one
    lockFile ? null
    # Generate shards.nix with `nix-shell -p crystal2nix --run crystal2nix` in the projects root
  , shardsFile ? null
  
negative.code:     "crystalBinaries"
    ];
  
    crystalLib = linkFarm "crystal-lib" (lib.mapAttrsToList
      (name: value: {
        inherit name;
        path = fetchFromGitHub value;
      })
      (import shardsFile));
  
    # we previously had --no-debug here but that is not recommended by upstream
    defaultOptions = [ "--release" "--progress" "--verbose" ];
  
    buildDirectly = shardsFile == null || crystalBinaries != { };
  
  in
  stdenv.mkDerivation (mkDerivationArgs // {
  
    configurePhase = args.configurePhase or lib.concatStringsSep "\n"
      (
        [
          "runHook preConfigure"
        ]
        ++ lib.optional (lockFile != null) "cp ${lockFile} ./shard.lock"
        ++ lib.optionals (shardsFile != null) [
          "test -e lib || mkdir lib"
          "for d in ${crystalLib}/*; do ln -s $d lib/; done"
          "cp shard.lock lib/.shards.info"
        ]
        ++ [ "runHook postConfigure" ]
      );
  
    CRFLAGS = lib.concatStringsSep " " defaultOptions;
  
  