diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index e32ccfa17939..f345e0b910aa 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1129,4 +1129,5 @@ self: super: { # Can be removed once yi-language >= 0.18 is in the LTS yi-core = super.yi-core.override { yi-language = self.yi-language_0_18_0; }; -} + +} // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix index 2f8cf9076e67..f73172e02d38 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix @@ -96,4 +96,4 @@ self: super: { haddock-library = dontHaddock (dontCheck self.haddock-library_1_5_0_1); })); -} // import ./configuration-tensorflow-ghc-8.2.x.nix {inherit pkgs haskellLib;} self super +} diff --git a/pkgs/development/haskell-modules/configuration-tensorflow-ghc-8.2.x.nix b/pkgs/development/haskell-modules/configuration-tensorflow-ghc-8.2.x.nix deleted file mode 100644 index 7fcb0e43eb67..000000000000 --- a/pkgs/development/haskell-modules/configuration-tensorflow-ghc-8.2.x.nix +++ /dev/null @@ -1,292 +0,0 @@ -{ pkgs, haskellLib }: - -with haskellLib; - -self: super: -let - tensorflow-haskell = pkgs.fetchFromGitHub { - owner = "tensorflow"; - repo = "haskell"; - rev = "e40d2c44f0a861701cc90ec73c2bcee669ab5ba7"; - sha256 = "05pda34jfrlqmb8y9l8g87n4iq87v1z820vnd3cy41v5c5nrdpa8"; - fetchSubmodules = true; - }; - - setSourceRoot = dir: drv: drv.overrideAttrs (_oldAttrs: {sourceRoot = "source/${dir}";}); - - proto-lens = self.proto-lens_0_2_2_0; - proto-lens-protoc = self.proto-lens-protoc_0_2_2_3; - proto-lens-protobuf-types = self.proto-lens-protobuf-types_0_2_2_0; - mainland-pretty = self.mainland-pretty_0_6_2; - lens-labels = self.lens-labels_0_1_0_2; - haskell-src-exts = self.haskell-src-exts_1_19_1; -in -{ - proto-lens-descriptors = super.proto-lens-descriptors.override { - inherit proto-lens lens-labels; - }; - proto-lens-protoc_0_2_2_3 = super.proto-lens-protoc_0_2_2_3.override { - inherit proto-lens haskell-src-exts; - }; - proto-lens-protobuf-types_0_2_2_0 = super.proto-lens-protobuf-types_0_2_2_0.override { - inherit proto-lens proto-lens-protoc; - }; - tensorflow-proto = setSourceRoot "tensorflow-proto" (super.callPackage ( - { mkDerivation, base, Cabal, proto-lens, proto-lens-protobuf-types - , proto-lens-protoc, stdenv - }: - mkDerivation { - pname = "tensorflow-proto"; - version = "0.1.0.0"; - src = tensorflow-haskell; - setupHaskellDepends = [ base Cabal proto-lens-protoc ]; - libraryHaskellDepends = [ - base proto-lens proto-lens-protobuf-types proto-lens-protoc - ]; - libraryToolDepends = [ pkgs.protobuf ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "TensorFlow protocol buffers"; - license = stdenv.lib.licenses.asl20; - } - ) { - inherit proto-lens proto-lens-protoc proto-lens-protobuf-types; - }); - tensorflow = setSourceRoot "tensorflow" (super.callPackage ( - { mkDerivation, async, attoparsec, base, bytestring, c2hs - , containers, data-default, exceptions, fgl, HUnit, lens-family - , mainland-pretty, mtl, proto-lens, semigroups, split, stdenv - , temporary, libtensorflow, tensorflow-proto, test-framework - , test-framework-hunit, test-framework-quickcheck2, text - , transformers, vector - }: - mkDerivation { - pname = "tensorflow"; - version = "0.1.0.2"; - src = tensorflow-haskell; - libraryHaskellDepends = [ - async attoparsec base bytestring containers data-default exceptions - fgl lens-family mainland-pretty mtl proto-lens semigroups split - temporary tensorflow-proto text transformers vector - ]; - librarySystemDepends = [ libtensorflow ]; - libraryToolDepends = [ c2hs ]; - testHaskellDepends = [ - attoparsec base bytestring HUnit lens-family proto-lens - tensorflow-proto test-framework test-framework-hunit - test-framework-quickcheck2 - ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "TensorFlow bindings"; - license = stdenv.lib.licenses.asl20; - } - ) { - inherit mainland-pretty proto-lens; - }); - tensorflow-core-ops = setSourceRoot "tensorflow-core-ops" (super.callPackage ( - { mkDerivation, base, bytestring, Cabal, directory, filepath - , lens-family, mainland-pretty, proto-lens, stdenv, tensorflow - , tensorflow-opgen, text - }: - mkDerivation { - pname = "tensorflow-core-ops"; - version = "0.1.0.0"; - src = tensorflow-haskell; - setupHaskellDepends = [ - base bytestring Cabal directory filepath mainland-pretty proto-lens - tensorflow tensorflow-opgen text - ]; - libraryHaskellDepends = [ - base bytestring lens-family proto-lens tensorflow text - ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "Haskell wrappers for Core Tensorflow Ops"; - license = stdenv.lib.licenses.asl20; - } - ) { - inherit mainland-pretty proto-lens; - }); - tensorflow-logging = setSourceRoot "tensorflow-logging" (super.callPackage ( - { mkDerivation, base, bytestring, conduit, data-default, directory - , exceptions, filepath, hostname, HUnit, lens-family, proto-lens - , resourcet, stdenv, stm, stm-chans, stm-conduit, temporary - , tensorflow, tensorflow-core-ops, tensorflow-ops, tensorflow-proto - , tensorflow-records-conduit, test-framework, test-framework-hunit - , text, time, transformers - }: - mkDerivation { - pname = "tensorflow-logging"; - version = "0.1.0.0"; - src = tensorflow-haskell; - libraryHaskellDepends = [ - base bytestring conduit data-default directory exceptions filepath - hostname lens-family proto-lens resourcet stm stm-chans stm-conduit - tensorflow tensorflow-core-ops tensorflow-ops tensorflow-proto - tensorflow-records-conduit text time transformers - ]; - testHaskellDepends = [ - base bytestring conduit data-default directory filepath HUnit - lens-family proto-lens resourcet temporary tensorflow - tensorflow-proto tensorflow-records-conduit test-framework - test-framework-hunit text - ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "TensorBoard related functionality"; - license = stdenv.lib.licenses.asl20; - } - ) { - inherit proto-lens; - }); - tensorflow-mnist = setSourceRoot "tensorflow-mnist" (super.callPackage ( - { mkDerivation, base, binary, bytestring, containers, filepath - , HUnit, lens-family, proto-lens, split, stdenv, tensorflow - , tensorflow-core-ops, tensorflow-mnist-input-data, tensorflow-ops - , tensorflow-proto, test-framework, test-framework-hunit, text - , transformers, vector, zlib - }: - mkDerivation { - pname = "tensorflow-mnist"; - version = "0.1.0.0"; - src = tensorflow-haskell; - isLibrary = true; - isExecutable = true; - enableSeparateDataOutput = true; - libraryHaskellDepends = [ - base binary bytestring containers filepath lens-family proto-lens - split tensorflow tensorflow-core-ops tensorflow-proto text vector - zlib - ]; - executableHaskellDepends = [ - base bytestring filepath lens-family proto-lens tensorflow - tensorflow-mnist-input-data tensorflow-ops tensorflow-proto text - transformers vector - ]; - testHaskellDepends = [ - base bytestring HUnit lens-family proto-lens tensorflow - tensorflow-mnist-input-data tensorflow-ops tensorflow-proto - test-framework test-framework-hunit text transformers vector - ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "TensorFlow demo application for learning MNIST model"; - license = stdenv.lib.licenses.asl20; - } - ) { - inherit proto-lens; - }); - tensorflow-mnist-input-data = setSourceRoot "tensorflow-mnist-input-data" (super.callPackage ( - { mkDerivation, base, bytestring, Cabal, cryptonite, directory - , filepath, HTTP, network-uri, stdenv - }: - mkDerivation { - pname = "tensorflow-mnist-input-data"; - version = "0.1.0.0"; - src = tensorflow-haskell; - enableSeparateDataOutput = true; - setupHaskellDepends = [ - base bytestring Cabal cryptonite directory filepath HTTP - network-uri - ]; - libraryHaskellDepends = [ base ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "Downloader of input data for training MNIST"; - license = stdenv.lib.licenses.asl20; - } - ) {}); - tensorflow-opgen = setSourceRoot "tensorflow-opgen" (super.callPackage ( - { mkDerivation, base, bytestring, containers, filepath, lens-family - , mainland-pretty, optparse-applicative, proto-lens, semigroups - , stdenv, tensorflow-proto, text - }: - mkDerivation { - pname = "tensorflow-opgen"; - version = "0.1.0.0"; - src = tensorflow-haskell; - libraryHaskellDepends = [ - base bytestring containers filepath lens-family mainland-pretty - optparse-applicative proto-lens semigroups tensorflow-proto text - ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "Code generation for TensorFlow operations"; - license = stdenv.lib.licenses.asl20; - } - ) { - inherit mainland-pretty proto-lens; - }); - tensorflow-ops = setSourceRoot "tensorflow-ops" (super.callPackage ( - { mkDerivation, base, bytestring, containers, criterion - , data-default, deepseq, fgl, HUnit, lens-family, mtl, proto-lens - , QuickCheck, random, stdenv, temporary, tensorflow - , tensorflow-core-ops, tensorflow-proto, tensorflow-test - , test-framework, test-framework-hunit, test-framework-quickcheck2 - , text, transformers, vector - }: - mkDerivation { - pname = "tensorflow-ops"; - version = "0.1.0.0"; - src = tensorflow-haskell; - libraryHaskellDepends = [ - base bytestring containers data-default fgl lens-family mtl - proto-lens tensorflow tensorflow-core-ops tensorflow-proto text - ]; - testHaskellDepends = [ - base bytestring data-default HUnit lens-family proto-lens - QuickCheck random temporary tensorflow tensorflow-core-ops - tensorflow-proto tensorflow-test test-framework - test-framework-hunit test-framework-quickcheck2 transformers vector - ]; - benchmarkHaskellDepends = [ - base criterion deepseq tensorflow transformers vector - ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "Friendly layer around TensorFlow bindings"; - license = stdenv.lib.licenses.asl20; - } - ) { - inherit proto-lens; - }); - tensorflow-records = setSourceRoot "tensorflow-records" (super.callPackage ( - { mkDerivation, base, bytestring, cereal, snappy-framing, stdenv - , test-framework, test-framework-quickcheck2 - }: - mkDerivation { - pname = "tensorflow-records"; - version = "0.1.0.0"; - src = tensorflow-haskell; - libraryHaskellDepends = [ base bytestring cereal snappy-framing ]; - testHaskellDepends = [ - base bytestring cereal test-framework test-framework-quickcheck2 - ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "Encoder and decoder for the TensorFlow \"TFRecords\" format"; - license = stdenv.lib.licenses.asl20; - } - ) {}); - tensorflow-records-conduit = setSourceRoot "tensorflow-records-conduit" (super.callPackage ( - { mkDerivation, base, bytestring, cereal-conduit, conduit - , conduit-extra, exceptions, resourcet, stdenv, tensorflow-records - }: - mkDerivation { - pname = "tensorflow-records-conduit"; - version = "0.1.0.0"; - src = tensorflow-haskell; - libraryHaskellDepends = [ - base bytestring cereal-conduit conduit conduit-extra exceptions - resourcet tensorflow-records - ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "Conduit wrappers for TensorFlow.Records."; - license = stdenv.lib.licenses.asl20; - } - ) {}); - tensorflow-test = setSourceRoot "tensorflow-test" (super.callPackage ( - { mkDerivation, base, HUnit, stdenv, vector }: - mkDerivation { - pname = "tensorflow-test"; - version = "0.1.0.0"; - src = tensorflow-haskell; - libraryHaskellDepends = [ base HUnit vector ]; - homepage = "https://github.com/tensorflow/haskell#readme"; - description = "Some common functions for test suites"; - license = stdenv.lib.licenses.asl20; - } - ) {}); -} diff --git a/pkgs/development/haskell-modules/configuration-tensorflow.nix b/pkgs/development/haskell-modules/configuration-tensorflow.nix new file mode 100644 index 000000000000..dfc93686405c --- /dev/null +++ b/pkgs/development/haskell-modules/configuration-tensorflow.nix @@ -0,0 +1,86 @@ +{ pkgs, haskellLib }: + +with haskellLib; + +self: super: +let + tensorflow-haskell = pkgs.fetchFromGitHub { + owner = "tensorflow"; + repo = "haskell"; + rev = "85bf0bb12cecfcdfcf31dea43b67cbe44576f685"; + sha256 = "1xbwc8y4a7n2163g746dpyh1q86rbxaw3d41kcy1mbhvmfqq56x7"; + fetchSubmodules = true; + }; + + setSourceRoot = dir: drv: drv.overrideAttrs (_oldAttrs: {sourceRoot = "source/${dir}";}); + + proto-lens = self.proto-lens_0_2_2_0; + proto-lens-protoc = self.proto-lens-protoc_0_2_2_3; + proto-lens-protobuf-types = self.proto-lens-protobuf-types_0_2_2_0; + mainland-pretty = self.mainland-pretty_0_6_2; +in +{ + proto-lens_0_2_2_0 = appendPatch super.proto-lens_0_2_2_0 ./patches/proto-lens-0.2.2.0.patch; + proto-lens-descriptors = doJailbreak (super.proto-lens-descriptors.override { + inherit proto-lens; + lens-labels = self.lens-labels_0_1_0_2; + }); + proto-lens-protoc_0_2_2_3 = appendPatch (addBuildDepend (super.proto-lens-protoc_0_2_2_3.override { + inherit proto-lens; + haskell-src-exts = self.haskell-src-exts_1_19_1; + }) self.semigroups) ./patches/proto-lens-protoc-0.2.2.3.patch; + proto-lens-protobuf-types_0_2_2_0 = doJailbreak (super.proto-lens-protobuf-types_0_2_2_0.override { + inherit proto-lens proto-lens-protoc; + }); + + lens-labels_0_1_0_2 = doJailbreak super.lens-labels_0_1_0_2; + + haskell-src-exts_1_19_1 = appendPatch (doJailbreak super.haskell-src-exts_1_19_1) ( + # Adapt to the Semigroup–Monoid Proposal (enables building on GHC >= 8.4) + pkgs.fetchpatch { + url = https://github.com/haskell-suite/haskell-src-exts/commit/258e072fe9e37f94360b7488b58ea2832843bbb8.patch; + sha256 = "0ja6ai41v9plinlhjwja282m6ahn6mw4xi79np0jxqk83cg0z1ff"; + } + ); + + tensorflow-proto = super.tensorflow-proto.override { + inherit proto-lens proto-lens-protoc proto-lens-protobuf-types; + }; + tensorflow = super.tensorflow.override { + inherit mainland-pretty proto-lens; + }; + tensorflow-core-ops = super.tensorflow-core-ops.override { + inherit mainland-pretty proto-lens; + }; + tensorflow-logging = super.tensorflow-logging.override { + inherit proto-lens; + }; + tensorflow-mnist = super.tensorflow-mnist.override { + inherit proto-lens; + }; + tensorflow-mnist-input-data = setSourceRoot "tensorflow-mnist-input-data" (super.callPackage ( + { mkDerivation, base, bytestring, Cabal, cryptonite, directory + , filepath, HTTP, network-uri, stdenv + }: + mkDerivation { + pname = "tensorflow-mnist-input-data"; + version = "0.1.0.0"; + src = tensorflow-haskell; + enableSeparateDataOutput = true; + setupHaskellDepends = [ + base bytestring Cabal cryptonite directory filepath HTTP + network-uri + ]; + libraryHaskellDepends = [ base ]; + homepage = "https://github.com/tensorflow/haskell#readme"; + description = "Downloader of input data for training MNIST"; + license = stdenv.lib.licenses.asl20; + } + ) {}); + tensorflow-opgen = super.tensorflow-opgen.override { + inherit mainland-pretty proto-lens; + }; + tensorflow-ops = super.tensorflow-ops.override { + inherit proto-lens; + }; +} diff --git a/pkgs/development/haskell-modules/patches/proto-lens-0.2.2.0.patch b/pkgs/development/haskell-modules/patches/proto-lens-0.2.2.0.patch new file mode 100644 index 000000000000..100a828a501a --- /dev/null +++ b/pkgs/development/haskell-modules/patches/proto-lens-0.2.2.0.patch @@ -0,0 +1,23 @@ +diff -Naur proto-lens-0.2.2.0/proto-lens.cabal proto-lens-0.2.2.0-patched/proto-lens.cabal +--- proto-lens-0.2.2.0/proto-lens.cabal 2018-08-13 18:05:41.704823370 +0200 ++++ proto-lens-0.2.2.0-patched/proto-lens.cabal 2018-08-13 18:07:42.352372300 +0200 +@@ -33,7 +33,7 @@ + Data.ProtoLens.Encoding.Wire + Data.ProtoLens.TextFormat.Parser + build-depends: attoparsec == 0.13.* +- , base >= 4.8 && < 4.11 ++ , base >= 4.8 + , bytestring == 0.10.* + , containers == 0.5.* + , data-default-class >= 0.0 && < 0.2 +diff -Naur proto-lens-0.2.2.0/src/Data/ProtoLens/TextFormat.hs proto-lens-0.2.2.0-patched/src/Data/ProtoLens/TextFormat.hs +--- proto-lens-0.2.2.0/src/Data/ProtoLens/TextFormat.hs 2017-04-28 02:16:46.000000000 +0200 ++++ proto-lens-0.2.2.0-patched/src/Data/ProtoLens/TextFormat.hs 2018-08-13 18:08:06.371486594 +0200 +@@ -17,6 +17,7 @@ + readMessageOrDie, + ) where + ++import Prelude hiding ((<>)) + import Lens.Family2 ((&),(^.),(.~), set, over) + import Control.Arrow (left) + import qualified Data.ByteString diff --git a/pkgs/development/haskell-modules/patches/proto-lens-protoc-0.2.2.3.patch b/pkgs/development/haskell-modules/patches/proto-lens-protoc-0.2.2.3.patch new file mode 100644 index 000000000000..87fd2aeab21b --- /dev/null +++ b/pkgs/development/haskell-modules/patches/proto-lens-protoc-0.2.2.3.patch @@ -0,0 +1,51 @@ +diff -Naur proto-lens-protoc-0.2.2.3/proto-lens-protoc.cabal proto-lens-protoc-0.2.2.3-patched/proto-lens-protoc.cabal +--- proto-lens-protoc-0.2.2.3/proto-lens-protoc.cabal 2018-07-21 22:55:12.041698876 +0200 ++++ proto-lens-protoc-0.2.2.3-patched/proto-lens-protoc.cabal 2018-08-13 19:44:44.993147985 +0200 +@@ -37,8 +37,8 @@ + default-language: Haskell2010 + hs-source-dirs: src + build-depends: +- Cabal >= 1.22 && < 2.1 +- , base >= 4.8 && < 4.11 ++ Cabal >= 1.22 ++ , base >= 4.8 + , bytestring == 0.10.* + , containers == 0.5.* + , data-default-class >= 0.0 && < 0.2 +@@ -53,6 +53,7 @@ + , proto-lens == 0.2.2.* + , proto-lens-descriptors == 0.2.2.* + , text == 1.2.* ++ , semigroups + reexported-modules: + -- Modules that are needed by the generated Haskell files. + -- For forwards compatibility, reexport them as new module names so that +@@ -76,7 +77,7 @@ + main-is: protoc-gen-haskell.hs + + build-depends: +- base >= 4.8 && < 4.11 ++ base >= 4.8 + , bytestring == 0.10.* + , containers == 0.5.* + , data-default-class >= 0.0 && < 0.2 +diff -Naur proto-lens-protoc-0.2.2.3/src/Data/ProtoLens/Compiler/Definitions.hs proto-lens-protoc-0.2.2.3-patched/src/Data/ProtoLens/Compiler/Definitions.hs +--- proto-lens-protoc-0.2.2.3/src/Data/ProtoLens/Compiler/Definitions.hs 2017-08-07 06:52:21.000000000 +0200 ++++ proto-lens-protoc-0.2.2.3-patched/src/Data/ProtoLens/Compiler/Definitions.hs 2018-08-13 19:14:07.240505220 +0200 +@@ -35,6 +35,7 @@ + import qualified Data.Map as Map + import Data.Maybe (fromMaybe) + import Data.Monoid ++import qualified Data.Semigroup as Semigroup + import qualified Data.Set as Set + import Data.String (IsString(..)) + import Data.Text (Text, cons, splitOn, toLower, uncons, unpack) +@@ -139,7 +140,7 @@ + -- a 'Symbol' is used to construct both the type-level argument to + -- @HasLens@ and the name of the function @foo@. + newtype Symbol = Symbol String +- deriving (Eq, Ord, IsString, Monoid) ++ deriving (Eq, Ord, IsString, Semigroup.Semigroup, Monoid) + + nameFromSymbol :: Symbol -> Name + nameFromSymbol (Symbol s) = fromString s