Skip to content

Commit

Permalink
haskell-tensorflow: unbreak
Browse files Browse the repository at this point in the history
- get the current Git head of haskell-tensorflow
- adjust dependencies
  • Loading branch information
mikesperber authored and peti committed Apr 17, 2020
1 parent d59d157 commit 53cfd1d
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 114 deletions.
110 changes: 70 additions & 40 deletions pkgs/development/haskell-modules/configuration-tensorflow.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,91 @@ with haskellLib;

self: super:
let
# This contains updates to the dependencies, without which it would
# be even more work to get it to build.
# As of 2020-04, there's no new release in sight, which is why we're
# pulling from Github.
tensorflow-haskell = pkgs.fetchFromGitHub {
owner = "tensorflow";
repo = "haskell";
rev = "85bf0bb12cecfcdfcf31dea43b67cbe44576f685";
sha256 = "1xbwc8y4a7n2163g746dpyh1q86rbxaw3d41kcy1mbhvmfqq56x7";
rev = "0f322b2e0611cbe7011c84ba8b6cb822e4725ebc";
sha256 = "15gn66i547q20sd50ixwm6yk1g00syfgxp8xa6xjd0i3kcsl3gs1";
fetchSubmodules = true;
};

setSourceRoot = dir: drv: drv.overrideAttrs (_oldAttrs: {sourceRoot = "source/${dir}";});
setTensorflowSourceRoot = dir: drv:
(overrideCabal drv (drv: { src = tensorflow-haskell; }))
.overrideAttrs (_oldAttrs: {sourceRoot = "source/${dir}";});

proto-lens = self.proto-lens;
proto-lens-protoc = self.proto-lens-protoc;
proto-lens-protobuf-types = self.proto-lens-protobuf-types;
mainland-pretty = self.mainland-pretty_0_6_2;
proto-lens = self.proto-lens_0_5_1_0;
proto-lens-protoc = self.proto-lens-protoc_0_5_0_0;
proto-lens-runtime = self.proto-lens-runtime_0_5_0_0;
proto-lens-protobuf-types = self.proto-lens-protobuf-types_0_5_0_0;
proto-lens-setup = self.proto-lens-setup_0_4_0_2;
lens-family = self.lens-family_1_2_3;
in
{
proto-lens = appendPatch super.proto-lens ./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;
lens-family_1_2_3 = super.lens-family_1_2_3.override {
lens-family-core = self.lens-family-core_1_2_3;
};

proto-lens_0_5_1_0 = (appendPatch (doJailbreak super.proto-lens_0_5_1_0) ./patches/proto-lens-0.5.1.0.patch).override {
inherit lens-family;
};

proto-lens-runtime_0_5_0_0 = doJailbreak (super.proto-lens-runtime_0_5_0_0.override {
inherit lens-family proto-lens;
});
proto-lens-protoc = appendPatch (addBuildDepend (super.proto-lens-protoc.override {
inherit proto-lens;
}) self.semigroups) ./patches/proto-lens-protoc-0.2.2.3.patch;
proto-lens-protobuf-types = doJailbreak (super.proto-lens-protobuf-types.override {
inherit proto-lens proto-lens-protoc;

proto-lens-protoc_0_5_0_0 = doJailbreak (super.proto-lens-protoc_0_5_0_0.override {
inherit lens-family proto-lens;
haskell-src-exts = self.haskell-src-exts_1_19_1;
});
proto-lens-setup_0_4_0_2 = appendPatch (doJailbreak (super.proto-lens-setup_0_4_0_2.override {
inherit proto-lens-protoc;
})) ./patches/proto-lens-setup-0.4.0.2.patch;

lens-labels_0_1_0_2 = doJailbreak super.lens-labels_0_1_0_2;
proto-lens-protobuf-types_0_5_0_0 = doJailbreak (super.proto-lens-protobuf-types_0_5_0_0.override {
inherit lens-family proto-lens proto-lens-runtime proto-lens-setup;
});

haskell-src-exts_1_19_1 = appendPatch (doJailbreak super.haskell-src-exts_1_19_1) (
haskell-src-exts_1_19_1 = appendPatches (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";
}
);
(pkgs.fetchpatch {
url = https://github.com/haskell-suite/haskell-src-exts/commit/258e072fe9e37f94360b7488b58ea2832843bbb8.patch;
sha256 = "0ja6ai41v9plinlhjwja282m6ahn6mw4xi79np0jxqk83cg0z1ff";
})
# Adapt to MonadFail proposal (enables building on GHC >= 8.8)
(pkgs.fetchpatch {
url = https://gist.githubusercontent.com/mikesperber/0f2addaf3fbe97ffb4a5234d8711ba41/raw/e09e20998283c7195e82d546ba9266d290eb000d/gistfile1.txt;
sha256 = "18clvli7vpqsqlf2f3qidn71738j9zdlpana6wha3x0dxwan5ly0";
}) ];

tensorflow-proto = super.tensorflow-proto.override {
inherit proto-lens proto-lens-protobuf-types;
tensorflow-proto = (setTensorflowSourceRoot "tensorflow-proto" super.tensorflow-proto).override {
inherit proto-lens proto-lens-runtime proto-lens-setup proto-lens-protobuf-types;
};
tensorflow = super.tensorflow.override {
inherit mainland-pretty proto-lens;

tensorflow = (setTensorflowSourceRoot "tensorflow" super.tensorflow).override {
inherit lens-family proto-lens;
# the "regular" Python package does not seem to include the binary library
libtensorflow = pkgs.libtensorflow-bin;
};
tensorflow-core-ops = super.tensorflow-core-ops.override {
inherit mainland-pretty proto-lens;

tensorflow-core-ops = (setTensorflowSourceRoot "tensorflow-core-ops" super.tensorflow-core-ops).override {
inherit lens-family proto-lens;
};
tensorflow-logging = super.tensorflow-logging.override {
inherit proto-lens;

tensorflow-logging = (setTensorflowSourceRoot "tensorflow-logging" super.tensorflow-logging).override {
inherit lens-family proto-lens;
};
tensorflow-mnist = overrideCabal (super.tensorflow-mnist.override {
inherit proto-lens;

tensorflow-mnist = (setTensorflowSourceRoot "tensorflow-mnist" super.tensorflow-mnist).override {
inherit lens-family proto-lens;
# https://github.com/tensorflow/haskell/issues/215
tensorflow-mnist-input-data = self.tensorflow-mnist-input-data;
}) (_drv: { broken = false; });
tensorflow-mnist-input-data = setSourceRoot "tensorflow-mnist-input-data" (super.callPackage (
};

tensorflow-mnist-input-data = setTensorflowSourceRoot "tensorflow-mnist-input-data" (super.callPackage (
{ mkDerivation, base, bytestring, Cabal, cryptonite, directory
, filepath, HTTP, network-uri, stdenv
}:
Expand All @@ -80,7 +109,6 @@ in
mkDerivation {
pname = "tensorflow-mnist-input-data";
version = "0.1.0.0";
src = tensorflow-haskell;
enableSeparateDataOutput = true;
setupHaskellDepends = [
base bytestring Cabal cryptonite directory filepath HTTP
Expand All @@ -95,10 +123,12 @@ in
license = stdenv.lib.licenses.asl20;
}
) {});
tensorflow-opgen = super.tensorflow-opgen.override {
inherit mainland-pretty proto-lens;

tensorflow-opgen = (setTensorflowSourceRoot "tensorflow-opgen" super.tensorflow-opgen).override {
inherit lens-family proto-lens;
};
tensorflow-ops = super.tensorflow-ops.override {
inherit proto-lens;

tensorflow-ops = (setTensorflowSourceRoot "tensorflow-ops" super.tensorflow-ops).override {
inherit lens-family proto-lens;
};
}
23 changes: 0 additions & 23 deletions pkgs/development/haskell-modules/patches/proto-lens-0.2.2.0.patch

This file was deleted.

23 changes: 23 additions & 0 deletions pkgs/development/haskell-modules/patches/proto-lens-0.5.1.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/src/Data/ProtoLens/Encoding/Parser/Internal.hs b/src/Data/ProtoLens/Encoding/Parser/Internal.hs
index 30eeaad..f2703e7 100644
--- a/src/Data/ProtoLens/Encoding/Parser/Internal.hs
+++ b/src/Data/ProtoLens/Encoding/Parser/Internal.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE CPP #-}
-- | Definition of the parsing monad, plus internal
-- unsafe functions.
module Data.ProtoLens.Encoding.Parser.Internal
@@ -36,8 +37,11 @@ instance Applicative Parser where
(<*>) = ap

instance Monad Parser where
- fail s = Parser $ \_ _ -> return $ ParseFailure s
return = pure
Parser f >>= g = Parser $ \end pos -> f end pos >>= \case
ParseSuccess pos' x -> unParser (g x) end pos'
ParseFailure s -> return $ ParseFailure s
+#if MIN_VERSION_base(4,13,0)
+instance MonadFail Parser where
+#endif
+ fail s = Parser $ \_ _ -> return $ ParseFailure s

This file was deleted.

Loading

0 comments on commit 53cfd1d

Please sign in to comment.