<commit_before>{ pkgs }:

with import ./lib.nix { inherit pkgs; };

self: super: {

  # Some packages need a non-core version of Cabal.
  Cabal_1_22_4_0 = super.Cabal_1_22_4_0.overrideScope (self: super: { binary = self.binary_0_7_6_1; });
  cabal-install = super.cabal-install.overrideScope (self: super: { Cabal = self.Cabal_1_24_0_0; });
  cabal-install_1_18_1_0 = (dontCheck super.cabal-install_1_18_1_0).overrideScope (self: super: { Cabal = self.Cabal_1_18_1_7; });

  # Link statically to avoid runtime dependency on GHC.
  jailbreak-cabal = (disableSharedExecutables super.jailbreak-cabal).override { Cabal = dontJailbreak self.Cabal_1_20_0_4; };

  # Apply NixOS-specific patches.
  ghc-paths = appendPatch super.ghc-paths ./patches/ghc-paths-nix.patch;

  # Break infinite recursions.
  clock = dontCheck super.clock;
  Dust-crypto = dontCheck super.Dust-crypto;
  hasql-postgres = dontCheck super.hasql-postgres;
  hspec_2_1_2 = super.hspec_2_1_2.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_3 = super.hspec_2_1_3.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_4 = super.hspec_2_1_4.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_5 = super.hspec_2_1_5.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_6 = super.hspec_2_1_6.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_7 = super.hspec_2_1_7.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_10 = super.hspec_2_1_10.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_2_1 = super.hspec_2_2_1.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_2_2 = super.hspec_2_2_2.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec-expectations_0_6_1_1 = dontCheck super.hspec-expectations_0_6_1_1;
  hspec-expectations_0_6_1 = dontCheck super.hspec-expectations_0_6_1;
  hspec-expectations_0_7_1 = dontCheck super.hspec-expectations_0_7_1;
  hspec-expectations = dontCheck super.hspec-expectations;
  hspec = super.hspec.override { stringbuilder = dontCheck super.stringbuilder; };
  HTTP = dontCheck super.HTTP;
  nanospec_0_2_0 = dontCheck super.nanospec_0_2_0;
  nanospec = dontCheck super.nanospec;
  options_1_2_1 = dontCheck super.options_1_2_1;
  options_1_2 = dontCheck super.options_1_2;
  options = dontCheck super.options;
  statistics = dontCheck super.statistics;
  c2hs = if pkgs.stdenv.isDarwin then dontCheck super.c2hs else super.c2hs;

  # Use the default version of mysql to build this package (which is actually mariadb).
  mysql = super.mysql.override { mysql = pkgs.mysql.lib; };

  # Link the proper version.
  zeromq4-haskell = super.zeromq4-haskell.override { zeromq = pkgs.zeromq4; };

  # This package needs a little help compiling properly on Darwin. Furthermore,
  # Stackage compiles git-annex without the Assistant, supposedly because not
  # all required dependencies are part of Stackage. To comply with Stackage, we
  # make 'git-annex-without-assistant' our default version, but offer another
  # build which has the assistant to be used in the top-level.
  git-annex_5_20150727 = (disableCabalFlag super.git-annex_5_20150727 "assistant").override {
    dbus = if pkgs.stdenv.isLinux then self.dbus else null;
    lsof = if pkgs.stdenv.isLinux then pkgs.lsof else null;
    fdo-notify = if pkgs.stdenv.isLinux then self.fdo-notify else null;
    hinotify = if pkgs.stdenv.isLinux then self.hinotify else self.fsnotify;
  };
  git-annex = (disableCabalFlag super.git-annex "assistant").override {
    dbus = if pkgs.stdenv.isLinux then self.dbus else null;
    lsof = if pkgs.stdenv.isLinux then pkgs.lsof else null;
    fdo-notify = if pkgs.stdenv.isLinux then self.fdo-notify else null;
    hinotify = if pkgs.stdenv.isLinux then self.hinotify else self.fsnotify;
  };
  git-annex-with-assistant = super.git-annex.override {
    dbus = if pkgs.stdenv.isLinux then self.dbus else null;
    fdo-notify = if pkgs.stdenv.isLinux then self.fdo-notify else null;
    hinotify = if pkgs.stdenv.isLinux then self.hinotify else self.fsnotify;
  };

  # CUDA needs help finding the SDK headers and libraries.
  cuda = overrideCabal super.cuda (drv: {
    extraLibraries = (drv.extraLibraries or []) ++ [pkgs.linuxPackages.nvidia_x11];
    configureFlags = (drv.configureFlags or []) ++
      pkgs.lib.optional pkgs.stdenv.is64bit "--extra-lib-dirs=${pkgs.cudatoolkit}/lib64" ++ [
      "--extra-lib-dirs=${pkgs.cudatoolkit}/lib"
      "--extra-include-dirs=${pkgs.cudatoolkit}/include"
    ];
    preConfigure = ''
      unset CC          # unconfuse the haskell-cuda configure script<commit_msg>git-annex: work around Joey Hess' latest brain fart<commit_after>{ pkgs }:

with import ./lib.nix { inherit pkgs; };

self: super: {

  # Some packages need a non-core version of Cabal.
  Cabal_1_22_4_0 = super.Cabal_1_22_4_0.overrideScope (self: super: { binary = self.binary_0_7_6_1; });
  cabal-install = super.cabal-install.overrideScope (self: super: { Cabal = self.Cabal_1_24_0_0; });
  cabal-install_1_18_1_0 = (dontCheck super.cabal-install_1_18_1_0).overrideScope (self: super: { Cabal = self.Cabal_1_18_1_7; });

  # Link statically to avoid runtime dependency on GHC.
  jailbreak-cabal = (disableSharedExecutables super.jailbreak-cabal).override { Cabal = dontJailbreak self.Cabal_1_20_0_4; };

  # Apply NixOS-specific patches.
  ghc-paths = appendPatch super.ghc-paths ./patches/ghc-paths-nix.patch;

  # Break infinite recursions.
  clock = dontCheck super.clock;
  Dust-crypto = dontCheck super.Dust-crypto;
  hasql-postgres = dontCheck super.hasql-postgres;
  hspec_2_1_2 = super.hspec_2_1_2.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_3 = super.hspec_2_1_3.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_4 = super.hspec_2_1_4.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_5 = super.hspec_2_1_5.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_6 = super.hspec_2_1_6.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_7 = super.hspec_2_1_7.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_1_10 = super.hspec_2_1_10.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_2_1 = super.hspec_2_2_1.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec_2_2_2 = super.hspec_2_2_2.override { stringbuilder = dontCheck super.stringbuilder; };
  hspec-expectations_0_6_1_1 = dontCheck super.hspec-expectations_0_6_1_1;
  hspec-expectations_0_6_1 = dontCheck super.hspec-expectations_0_6_1;
  hspec-expectations_0_7_1 = dontCheck super.hspec-expectations_0_7_1;
  hspec-expectations = dontCheck super.hspec-expectations;
  hspec = super.hspec.override { stringbuilder = dontCheck super.stringbuilder; };
  HTTP = dontCheck super.HTTP;
  nanospec_0_2_0 = dontCheck super.nanospec_0_2_0;
  nanospec = dontCheck super.nanospec;
  options_1_2_1 = dontCheck super.options_1_2_1;
  options_1_2 = dontCheck super.options_1_2;
  options = dontCheck super.options;
  statistics = dontCheck super.statistics;
  c2hs = if pkgs.stdenv.isDarwin then dontCheck super.c2hs else super.c2hs;

  # Use the default version of mysql to build this package (which is actually mariadb).
  mysql = super.mysql.override { mysql = pkgs.mysql.lib; };

  # Link the proper version.
  zeromq4-haskell = super.zeromq4-haskell.override { zeromq = pkgs.zeromq4; };

  # This package needs a little help compiling properly on Darwin. Furthermore,
  # Stackage compiles git-annex without the Assistant, supposedly because not
  # all required dependencies are part of Stackage. To comply with Stackage, we
  # make 'git-annex-without-assistant' our default version, but offer another
  # build which has the assistant to be used in the top-level.
  git-annex_5_20150727 = (disableCabalFlag super.git-annex_5_20150727 "assistant").override {
    dbus = if pkgs.stdenv.isLinux then self.dbus else null;
    lsof = if pkgs.stdenv.isLinux then pkgs.lsof else null;
    fdo-notify = if pkgs.stdenv.isLinux then self.fdo-notify else null;
    hinotify = if pkgs.stdenv.isLinux then self.hinotify else self.fsnotify;
  };
  git-annex = (disableCabalFlag super.git-annex "assistant").override {
    dbus = if pkgs.stdenv.isLinux then self.dbus else null;
    lsof = if pkgs.stdenv.isLinux then pkgs.lsof else null;
    fdo-notify = if pkgs.stdenv.isLinux then self.fdo-notify else null;
    hinotify = if pkgs.stdenv.isLinux then self.hinotify else self.fsnotify;
  };
  # <NAME> is nuts. The release tarball uploaded to Hackage deliberately
  # lacks files to break in the installation procedure, because ... you know
  # ... because! He feels people shouldn't use the tarballs he publishes and
  # instead use the git repository instead. Which makes me seriously wonder why
  # the f*ck I'm spending my spare time packaging this crap when I could just
  # as well install Syncthing in the time I routinely waste adding kludges to
  # work around this guy's crazy ideas of how to express his individuality.
  git-annex-with-assistant = (overrideCabal super.git-annex (drv: {
    src = pkgs.fetchFromGitHub {
      owner = "joeyh";
      repo = "git-annex";
      sha256 = "1cmyf94jvfjwiibmhkkbrplq63g1yvy5kn65993zs10zgcfip3jb";
      rev = drv.version;
    };
  })).override {
    dbus = if pkgs.stdenv.isLinux then self.dbus else null;
    fdo-notify = if pkgs.stdenv.isLinux then self.fdo-notify else null;
    hinotify = if pkgs.stdenv.isLinux then self.hinotify else self.fsnotify;
  };

  # CUDA needs help finding the SDK headers and libraries.
  cuda = overrideCabal super.cuda (drv: {
    extraLibraries = (drv.extraLibraries or []) ++ [pkgs.linuxPackages.nvidia_x11];
    configureFlags = (drv.configureFlags or []) ++
      pkgs.lib.optional pkgs.stdenv.is64bit "--extra-lib-dirs=${pkgs.cudatoolkit}/lib64" ++ [
      "--extra-lib-dirs=${pkgs.cudatoolkit}/lib"
      "--extra-include-dirs=${pkgs.cudatoolkit}/include"
    ];
    preConfigure = ''
      unset CC          # unconfuse the haskell-cuda configure script
{'fraction_non_alphanumeric': 0.09742882474633041, 'fraction_numerical': 0.033494237020983156, 'mean_word_length': 4.169042769857434, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 1, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1084505', 'n_tokens_mistral': 3780, 'n_tokens_neox': 3621, 'n_words': 816}