Skip to content

Instantly share code, notes, and snippets.

@yorickvP
Last active September 10, 2019 18:49
Show Gist options
  • Save yorickvP/6a078acf1df739e5a063b24014b5a961 to your computer and use it in GitHub Desktop.
Save yorickvP/6a078acf1df739e5a063b24014b5a961 to your computer and use it in GitHub Desktop.
diff --git a/src/lib_base/p2p_addr.ml b/src/lib_base/p2p_addr.ml
index b2c78e40..cecc8efc 100644
--- a/src/lib_base/p2p_addr.ml
+++ b/src/lib_base/p2p_addr.ml
@@ -30,7 +30,7 @@ let encoding =
def "p2p_address" ~description:"An address for locating peers."
@@ splitted
~json:(conv Ipaddr.V6.to_string Ipaddr.V6.of_string_exn string)
- ~binary:(conv Ipaddr.V6.to_bytes Ipaddr.V6.of_bytes_exn string)
+ ~binary:(conv Ipaddr.V6.to_octets Ipaddr.V6.of_octets_exn string)
type port = int
diff --git a/src/lib_protocol_environment/tezos_protocol_environment.ml b/src/lib_protocol_environment/tezos_protocol_environment.ml
index 45595566..62f71943 100644
--- a/src/lib_protocol_environment/tezos_protocol_environment.ml
+++ b/src/lib_protocol_environment/tezos_protocol_environment.ml
@@ -350,7 +350,7 @@ struct
let bits = to_bits z in
let len = Pervasives.((numbits z + 7) / 8) in
let full_len = Compare.Int.max pad_to len in
- if full_len = 0 then MBytes.empty
+ if full_len == 0 then MBytes.empty
else
let res = MBytes.make full_len '\000' in
MBytes.blit_of_string bits 0 res 0 len ;
{ pkgs ? import <nixpkgs> { } }:
let
oca = pkgs.ocaml-ng.ocamlPackages_4_07.overrideScope' (self: super: {
tezosPackage = self.callPackage ({ buildDunePackage, fetchgit }: (args:
buildDunePackage ({
version = "0.0.1";
minimumOCamlVersion = "4.07";
#src = ./.;
src = fetchgit {
url = "https://gitlab.com/tezos/tezos.git/";
rev = "2613d9058252322183ec1bc45d69dcc12ea1b51c";
sha256 = "1hxf87a5sw1s6h1af2hc7gwy0ji3070yrpp8vmsl5zirf65ahjyl";
};
preInstall = ''
cp src/*/*.install .
'';
} // args))) {};
bigstring = self.callPackage
({ stdenv, fetchFromGitHub, buildDunePackage, base }:
buildDunePackage rec {
pname = "bigstring";
version = "0.2";
minimumOCamlVersion = "4.03";
src = fetchFromGitHub {
owner = "c-cube";
repo = "ocaml-${pname}";
rev = version;
sha256 = "0ypdf29cmwmjm3djr5ygz8ls81dl41a4iz1xx5gbcdpbrdiapb77";
};
buildInputs = [ base ];
doCheck = true;
}) { };
nonstd = self.callPackage
({ stdenv, fetchgit, buildDunePackage, base }:
buildDunePackage rec {
pname = "nonstd";
version = "0.0.3";
minimumOCamlVersion = "4.03";
src = fetchgit {
url = "https://bitbucket.org/smondet/nonstd.git";
rev = "${pname}.${version}";
sha256 = "0ccjwcriwm8fv29ij1cnbc9win054kb6pfga3ygzdbjpjb778j46";
};
#doCheck = true;
}) { };
sosa = self.callPackage
({ stdenv, fetchFromGitHub, buildDunePackage, ocamlbuild }:
buildDunePackage rec {
pname = "sosa";
version = "0.3.0";
minimumOCamlVersion = "4.03";
src = fetchFromGitHub {
owner = "hammerlab";
repo = "${pname}";
rev = "${pname}.${version}";
sha256 = "053hdv6ww0q4mivajj4iyp7krfvgq8zajq9d8x4mia4lid7j0dyk";
};
buildInputs = [ ocamlbuild ];
buildPhase = "make build";
installPhase = ''
mkdir -p $out/lib/ocaml/4.07.1/site-lib
make install
'';
doCheck = false;
}) { };
genspio = self.callPackage
({ stdenv, fetchFromGitHub, buildDunePackage, nonstd, sosa, base }:
buildDunePackage rec {
pname = "genspio";
version = "0.0.2";
minimumOCamlVersion = "4.03";
src = fetchFromGitHub {
owner = "hammerlab";
repo = "${pname}";
rev = "genspio.${version}";
sha256 = "0cp6p1f713sfv4p2r03bzvjvakzn4ili7hf3a952b3w1k39hv37x";
};
propagatedBuildInputs = [ nonstd sosa ];
configurePhase = "ocaml please.mlt configure";
doCheck = false;
}) { };
dum = self.callPackage
({ stdenv, fetchFromGitHub, buildDunePackage, easy-format }:
buildDunePackage rec {
pname = "dum";
version = "1.0.1";
minimumOCamlVersion = "4.03";
buildPhase = "";
installPhase = ''
mkdir -p $out/lib/ocaml/4.07.1/site-lib
make install
'';
src = fetchFromGitHub {
owner = "mjambon";
repo = "${pname}";
rev = "v${version}";
sha256 = "0yrxl97szjc0s2ghngs346x3y0xszx2chidgzxk93frjjpsr1mlr";
};
buildInputs = [ easy-format ];
doCheck = false;
}) { };
hidapi = self.callPackage
({ stdenv, fetchFromGitHub, buildDunePackage, hidapi, bigstring, pkg-config }:
buildDunePackage rec {
pname = "hidapi";
version = "1.1.1";
minimumOCamlVersion = "4.03";
src = fetchFromGitHub {
owner = "vbmithr";
repo = "ocaml-${pname}";
rev = version;
sha256 = "1qhc8iby3i54zflbi3yrnhpg62pwdl6g2sfnykgashjy7ghh495y";
};
buildInputs = [ bigstring hidapi pkg-config ];
doCheck = true;
}) { hidapi = pkgs.hidapi; };
irmin = self.callPackage
({ stdenv, fetchFromGitHub, buildDunePackage, fmt, uri, jsonm, lwt4, logs, base64, digestif, ocamlgraph, astring, hex, alcotest }:
buildDunePackage rec {
pname = "irmin";
version = "1.4.0";
minimumOCamlVersion = "4.03";
src = fetchFromGitHub {
owner = "mirage";
repo = pname;
rev = version;
sha256 = "0f272h9d0hs0wn5m30348wx7vz7524yk40wx5lx895vv3r3p7q7c";
};
buildInputs = [ fmt uri jsonm lwt4 base64 digestif logs ocamlgraph astring hex alcotest ];
doCheck = true;
}) { };
ipaddr = super.ipaddr.overrideDerivation (o: rec {
version = "4.0.0";
src = pkgs.fetchFromGitHub {
owner = "mirage";
repo = "ocaml-${o.pname}";
rev = "v${version}";
sha256 = "1ywhabdji7hqrmr07dcxlsxf5zndagrdxx378csi5bv3c5n9547z";
};
buildPhase = "dune build -p ipaddr,macaddr,ipaddr-sexp";
propagatedBuildInputs = o.propagatedBuildInputs ++ [ self.domain-name ];
});
conduit = super.conduit.overrideDerivation (o: rec {
version = "2.0.1";
src = pkgs.fetchFromGitHub {
owner = "mirage";
repo = "ocaml-${o.pname}";
rev = "v${version}";
sha256 = "0v4lxc6g9mavx8nk7djzsvx1blw5wsjn2cg6k6a35fyv64xmwd73";
};
propagatedBuildInputs = o.propagatedBuildInputs ++ [ self.sexplib ];
});
conduit-lwt-unix = super.conduit-lwt-unix.overrideDerivation (o: rec {
version = "2.0.1";
src = pkgs.fetchFromGitHub {
owner = "mirage";
repo = "ocaml-${o.pname}";
rev = "v${version}";
sha256 = "0v4lxc6g9mavx8nk7djzsvx1blw5wsjn2cg6k6a35fyv64xmwd73";
};
propagatedBuildInputs = [ self.conduit-lwt self.logs self.tls ];
});
cohttp = super.cohttp.overrideDerivation (o: rec {
version = "2.3.0";
name = "cohttp-2.3.0";
src = pkgs.fetchFromGitHub {
owner = "mirage";
repo = "ocaml-${o.pname}";
rev = "v${version}";
sha256 = "0fag9zhv1lhbq1p4p1cmbav009x2d79kq3iv04pisj5y071qhhvr";
};
propagatedBuildInputs = o.propagatedBuildInputs ++ [ self.stdlib-shims ];
});
domain-name = self.callPackage ({ stdenv, fetchFromGitHub, buildDunePackage, fmt, astring }:
buildDunePackage rec {
pname = "domain-name";
version = "0.3.0";
src = pkgs.fetchFromGitHub {
owner = "hannesm";
repo = "${pname}";
rev = "v${version}";
sha256 = "06l82k27wa446k0sd799i73rrqwwmqfm542blkx6bbm2xpxaz2cm";
};
propagatedBuildInputs = [ fmt astring ];
}) {};
tezos = self.callPackage ({ stdenv, fetchgit, buildDunePackage, base
, bigstring, cohttp-lwt, cohttp-lwt-unix, cstruct, ezjsonm, hex,
ipaddr, js_of_ocaml, cmdliner, easy-format, ocp-ocamlres, tls,
lwt4, lwt_log, mtime, ocplib-endian, ptime, re, rresult, stdio, uri, uutf
, zarith, libusb, hidapi, gmp, irmin, alcotest, dum, genspio, pprint, ocamlgraph,findlib,git
}:
buildDunePackage rec {
pname = "tezos";
version = "0.0.1";
minimumOCamlVersion = "4.07";
#src = ./.;
patches = [ ./fix.patch ];
src = fetchgit {
url = "https://gitlab.com/tezos/tezos.git/";
rev = "2613d9058252322183ec1bc45d69dcc12ea1b51c";
sha256 = "1hxf87a5sw1s6h1af2hc7gwy0ji3070yrpp8vmsl5zirf65ahjyl";
};
preInstall = ''
cp src/*/*.install .
'';
buildInputs = [
base bigstring cohttp-lwt cohttp-lwt-unix cstruct ezjsonm
irmin hex hidapi ipaddr lwt4 lwt_log mtime ocplib-endian
ptime re rresult stdio
uri uutf zarith cmdliner easy-format js_of_ocaml ocp-ocamlres tls
alcotest dum pprint
ocamlgraph findlib genspio git
] ++ [ libusb hidapi gmp ];
doCheck = false;
buildPhase = "dune build";
}) { git = pkgs.git; };
});
in oca.tezos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment