From 421bf2ac0837e5652898ce7f7b983dc727fd5920 Mon Sep 17 00:00:00 2001
From: tv <tv@shackspace.de>
Date: Sat, 17 Oct 2015 05:50:58 +0200
Subject: [PATCH] krebs pkgs: init haskell-overrides

---
 krebs/5pkgs/default.nix                       | 14 ++++
 krebs/5pkgs/haskell-overrides/blessings.nix   | 14 ++++
 .../5pkgs/haskell-overrides/email-header.nix  | 25 +++++++
 krebs/5pkgs/haskell-overrides/scanner.nix     | 12 ++++
 krebs/5pkgs/much/default.nix                  | 66 +------------------
 5 files changed, 66 insertions(+), 65 deletions(-)
 create mode 100644 krebs/5pkgs/haskell-overrides/blessings.nix
 create mode 100644 krebs/5pkgs/haskell-overrides/email-header.nix
 create mode 100644 krebs/5pkgs/haskell-overrides/scanner.nix

diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index 77519e831..e7fedce53 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -9,6 +9,20 @@ in
 
 subdirs // rec {
 
+  haskellPackages = pkgs.haskellPackages.override {
+    overrides = self: super:
+      mapAttrs (name: path: self.callPackage path {})
+        (mapAttrs'
+          (name: type:
+            if hasSuffix ".nix" name
+              then {
+                name = removeSuffix ".nix" name;
+                value = ./haskell-overrides + "/${name}";
+              }
+              else null)
+          (builtins.readDir ./haskell-overrides));
+  };
+
   push = pkgs'.callPackage ./push {
     inherit (subdirs) get jq;
   };
diff --git a/krebs/5pkgs/haskell-overrides/blessings.nix b/krebs/5pkgs/haskell-overrides/blessings.nix
new file mode 100644
index 000000000..311458211
--- /dev/null
+++ b/krebs/5pkgs/haskell-overrides/blessings.nix
@@ -0,0 +1,14 @@
+{ mkDerivation, base, fetchgit, stdenv }:
+mkDerivation {
+  pname = "blessings";
+  version = "1.0.0";
+  src = fetchgit {
+    url = http://cgit.cd.retiolum/blessings;
+    rev = "25a510dcb38ea9158e9969d56eb66cb1b860ab5f";
+    sha256 = "b962153e80e51519b52220199d8350b54154833e4bc25a792ecc58898fef3fb2";
+  };
+  libraryHaskellDepends = [ base ];
+  doHaddock = false;
+  # WTFPL is the true license, which is unknown to cabal.
+  license = stdenv.lib.licenses.wtfpl;
+}
diff --git a/krebs/5pkgs/haskell-overrides/email-header.nix b/krebs/5pkgs/haskell-overrides/email-header.nix
new file mode 100644
index 000000000..8c62f2f70
--- /dev/null
+++ b/krebs/5pkgs/haskell-overrides/email-header.nix
@@ -0,0 +1,25 @@
+{ mkDerivation, attoparsec, base, base64-bytestring, bytestring
+, case-insensitive, containers, exceptions, fetchgit, QuickCheck
+, stdenv, tasty, tasty-quickcheck, text, text-icu, time
+}:
+mkDerivation {
+  pname = "email-header";
+  version = "0.3.0";
+  src = fetchgit {
+    url = "https://github.com/4z3/email-header";
+    sha256 = "f33fba567a39b1f2448869b269c26c40d8007599c23ab83bde5b4dfd9fd76ebc";
+    rev = "7b179bd31192ead8afe7a0b6e34bcad4039deaa8";
+  };
+  buildDepends = [
+    attoparsec base base64-bytestring bytestring case-insensitive
+    containers exceptions text text-icu time
+  ];
+  testDepends = [
+    base bytestring case-insensitive containers QuickCheck tasty
+    tasty-quickcheck text time
+  ];
+  jailbreak = true;
+  homepage = "http://github.com/knrafto/email-header";
+  description = "Parsing and rendering of email and MIME headers";
+  license = stdenv.lib.licenses.bsd3;
+}
diff --git a/krebs/5pkgs/haskell-overrides/scanner.nix b/krebs/5pkgs/haskell-overrides/scanner.nix
new file mode 100644
index 000000000..ebc5cd620
--- /dev/null
+++ b/krebs/5pkgs/haskell-overrides/scanner.nix
@@ -0,0 +1,12 @@
+{ mkDerivation, base, fetchgit, stdenv }:
+mkDerivation {
+  pname = "scanner";
+  version = "1.0.0";
+  src = fetchgit {
+    url = http://cgit.cd.retiolum/scanner;
+    rev = "7f091a3bc152ad3974a1873b460fa1759bf8dcad";
+    sha256 = "7d123c227777932039d26fc832b8d32a90f04c0bd6b7e8bcff0a6f49a54e0054";
+  };
+  libraryHaskellDepends = [ base ];
+  license = stdenv.lib.licenses.wtfpl;
+}
diff --git a/krebs/5pkgs/much/default.nix b/krebs/5pkgs/much/default.nix
index f28e0b5bc..ba5ab2327 100644
--- a/krebs/5pkgs/much/default.nix
+++ b/krebs/5pkgs/much/default.nix
@@ -1,70 +1,6 @@
 { pkgs, ... }:
 
-let
-  hspkgs = pkgs.haskellngPackages.override {
-    overrides = self: super: {
-      blessings = self.callPackage (
-{ mkDerivation, base, fetchgit, stdenv }:
-mkDerivation {
-  pname = "blessings";
-  version = "1.0.0";
-  src = fetchgit {
-    url = http://cgit.cd.retiolum/blessings;
-    rev = "25a510dcb38ea9158e9969d56eb66cb1b860ab5f";
-    sha256 = "b962153e80e51519b52220199d8350b54154833e4bc25a792ecc58898fef3fb2";
-  };
-  libraryHaskellDepends = [ base ];
-  doHaddock = false;
-  # WTFPL is the true license, which is unknown to cabal.
-  license = stdenv.lib.licenses.wtfpl;
-}
-) {};
-      email-header = self.callPackage (
-{ mkDerivation, attoparsec, base, base64-bytestring, bytestring
-, case-insensitive, containers, exceptions, fetchgit, QuickCheck
-, stdenv, tasty, tasty-quickcheck, text, text-icu, time
-}:
-mkDerivation {
-  pname = "email-header";
-  version = "0.3.0";
-  src = fetchgit {
-    url = "https://github.com/4z3/email-header";
-    sha256 = "f33fba567a39b1f2448869b269c26c40d8007599c23ab83bde5b4dfd9fd76ebc";
-    rev = "7b179bd31192ead8afe7a0b6e34bcad4039deaa8";
-  };
-  buildDepends = [
-    attoparsec base base64-bytestring bytestring case-insensitive
-    containers exceptions text text-icu time
-  ];
-  testDepends = [
-    base bytestring case-insensitive containers QuickCheck tasty
-    tasty-quickcheck text time
-  ];
-  jailbreak = true;
-  homepage = "http://github.com/knrafto/email-header";
-  description = "Parsing and rendering of email and MIME headers";
-  license = stdenv.lib.licenses.bsd3;
-}
-) {};
-      scanner = self.callPackage (
-{ mkDerivation, base, fetchgit, stdenv }:
-mkDerivation {
-  pname = "scanner";
-  version = "1.0.0";
-  src = fetchgit {
-    url = http://cgit.cd.retiolum/scanner;
-    rev = "7f091a3bc152ad3974a1873b460fa1759bf8dcad";
-    sha256 = "7d123c227777932039d26fc832b8d32a90f04c0bd6b7e8bcff0a6f49a54e0054";
-  };
-  libraryHaskellDepends = [ base ];
-  license = stdenv.lib.licenses.wtfpl;
-}
-) {};
-    };
-  };
-in
-
-hspkgs.callPackage (
+pkgs.haskellngPackages.callPackage (
 { mkDerivation, aeson, attoparsec, base, base64-bytestring
 , blaze-builder, blessings, bytestring, case-insensitive, containers, deepseq
 , directory, docopt, email-header, fetchgit, filepath