This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
109
unikernel/duniverse/ocaml-h2/nix/ci/test.nix
Normal file
109
unikernel/duniverse/ocaml-h2/nix/ci/test.nix
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
{ ocamlVersion }:
|
||||
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./../../flake.lock);
|
||||
src = fetchGit {
|
||||
url = with lock.nodes.nixpkgs.locked; "https://github.com/${owner}/${repo}";
|
||||
inherit (lock.nodes.nixpkgs.locked) rev;
|
||||
allRefs = true;
|
||||
};
|
||||
|
||||
nix-filter-src = fetchGit {
|
||||
url = with lock.nodes.nix-filter.locked; "https://github.com/${owner}/${repo}";
|
||||
inherit (lock.nodes.nix-filter.locked) rev;
|
||||
# inherit (lock.nodes.nixpkgs.original) ref;
|
||||
allRefs = true;
|
||||
};
|
||||
nix-filter = import "${nix-filter-src}";
|
||||
|
||||
|
||||
pkgs = import "${src}" {
|
||||
extraOverlays = [
|
||||
(self: super: {
|
||||
ocamlPackages = super.ocaml-ng."ocamlPackages_${ocamlVersion}".overrideScope (oself: osuper: {
|
||||
gluten-lwt-unix = osuper.gluten-lwt-unix.overrideAttrs (o: {
|
||||
propagatedBuildInputs = o.propagatedBuildInputs ++ [ oself.tls-lwt ];
|
||||
});
|
||||
});
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
inherit (pkgs) lib stdenv fetchTarball ocamlPackages h2spec;
|
||||
|
||||
h2Pkgs = pkgs.callPackage ./.. { inherit nix-filter; };
|
||||
h2Drvs = lib.filterAttrs (_: value: lib.isDerivation value) h2Pkgs;
|
||||
srcs = lib.mapAttrsFlatten (n: v: v.src) h2Drvs ++ [
|
||||
(with nix-filter; filter {
|
||||
root = ../..;
|
||||
include = [ "spec" ".ocamlformat" ".ocamlformat-ignore" ];
|
||||
})
|
||||
];
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "h2-conformance-tests";
|
||||
inherit srcs;
|
||||
sourceRoot = "./h2-tests";
|
||||
unpackPhase = ''
|
||||
shopt -s dotglob
|
||||
|
||||
for src in $srcs; do
|
||||
cp -a $src "./testdir-$(basename $src)"
|
||||
done
|
||||
|
||||
mkdir h2-tests
|
||||
|
||||
chmod u+w -R testdir-*
|
||||
mv --backup=numbered testdir-*/* h2-tests
|
||||
'';
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
touch $out
|
||||
'';
|
||||
buildInputs =
|
||||
(lib.attrValues h2Drvs) ++
|
||||
(with ocamlPackages; [ ocaml dune findlib ocamlformat httpun-lwt-unix ]) ++
|
||||
(with pkgs; [ lsof h2spec ]);
|
||||
checkInputs = with ocamlPackages; [ alcotest hex yojson ];
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
# Check code is formatted with OCamlformat
|
||||
dune build --root=. @fmt
|
||||
|
||||
# Build the examples
|
||||
dune build @all --display=short
|
||||
|
||||
dune build --root=. --display=short spec/lwt_h2spec.exe
|
||||
dune exec --display=short spec/lwt_h2spec.exe &
|
||||
while [ -z "$(lsof -t -i tcp:8080)" ]; do
|
||||
sleep 1;
|
||||
done;
|
||||
|
||||
h2spec --strict -p 8080 -P /string
|
||||
|
||||
h2spec --strict -p 8080 -P /bigstring
|
||||
|
||||
h2spec --strict -p 8080 --timeout 3 -P /streaming
|
||||
|
||||
kill $(lsof -i tcp:8080 -t)
|
||||
|
||||
# Run Eio h2spec now
|
||||
${if lib.versionOlder "5.0" ocamlPackages.ocaml.version then ''
|
||||
dune build --display=short spec/eio_h2spec.exe
|
||||
dune exec --display=short spec/eio_h2spec.exe &
|
||||
while [ -z "$(lsof -t -i tcp:8080)" ]; do
|
||||
sleep 1;
|
||||
done;
|
||||
|
||||
h2spec --strict -p 8080 -P /string
|
||||
|
||||
h2spec --strict -p 8080 -P /bigstring
|
||||
|
||||
h2spec --strict -p 8080 --timeout 3 -P /streaming
|
||||
|
||||
kill $(lsof -i tcp:8080 -t)
|
||||
'' else ""}
|
||||
'';
|
||||
}
|
||||
115
unikernel/duniverse/ocaml-h2/nix/default.nix
Normal file
115
unikernel/duniverse/ocaml-h2/nix/default.nix
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
{ nix-filter, lib, stdenv, ocamlPackages, doCheck ? true }:
|
||||
|
||||
let
|
||||
inherit (ocamlPackages) buildDunePackage ocaml;
|
||||
version = "dev";
|
||||
h2Pkgs = rec {
|
||||
hpack = buildDunePackage {
|
||||
pname = "hpack";
|
||||
src = with nix-filter; filter {
|
||||
root = ./..;
|
||||
include = [ "dune-project" "hpack" "hpack.opam" ];
|
||||
};
|
||||
|
||||
inherit version doCheck;
|
||||
checkInputs = with ocamlPackages; [ alcotest hex yojson ];
|
||||
propagatedBuildInputs = with ocamlPackages; [ angstrom faraday ];
|
||||
checkPhase = ''
|
||||
dune build @slowtests -p hpack --no-buffer --force
|
||||
'';
|
||||
};
|
||||
|
||||
h2 = buildDunePackage {
|
||||
pname = "h2";
|
||||
inherit version doCheck;
|
||||
src = with nix-filter; filter {
|
||||
root = ./..;
|
||||
include = [ "dune-project" "lib" "lib_test" "h2.opam" ];
|
||||
};
|
||||
|
||||
checkInputs = with ocamlPackages; [ alcotest hex yojson ];
|
||||
propagatedBuildInputs = with ocamlPackages; [
|
||||
angstrom
|
||||
faraday
|
||||
base64
|
||||
psq
|
||||
httpun
|
||||
] ++ [ h2Pkgs.hpack ];
|
||||
};
|
||||
|
||||
# These two don't have tests
|
||||
h2-lwt = buildDunePackage {
|
||||
pname = "h2-lwt";
|
||||
inherit version;
|
||||
src = with nix-filter; filter {
|
||||
root = ./..;
|
||||
include = [ "dune-project" "lwt" "h2-lwt.opam" ];
|
||||
};
|
||||
|
||||
doCheck = false;
|
||||
propagatedBuildInputs = with ocamlPackages;
|
||||
[ lwt gluten-lwt ] ++ [ h2Pkgs.h2 ];
|
||||
};
|
||||
|
||||
h2-lwt-unix = buildDunePackage {
|
||||
pname = "h2-lwt-unix";
|
||||
inherit version;
|
||||
src = with nix-filter; filter {
|
||||
root = ./..;
|
||||
include = [ "dune-project" "lwt-unix" "h2-lwt-unix.opam" ];
|
||||
};
|
||||
doCheck = false;
|
||||
propagatedBuildInputs = with ocamlPackages; [
|
||||
gluten-lwt-unix
|
||||
faraday-lwt-unix
|
||||
lwt_ssl
|
||||
] ++ [ h2Pkgs.h2-lwt ];
|
||||
};
|
||||
h2-async = buildDunePackage {
|
||||
pname = "h2-async";
|
||||
inherit version;
|
||||
src = with nix-filter; filter {
|
||||
root = ./..;
|
||||
include = [ "dune-project" "async" "h2-async.opam" ];
|
||||
};
|
||||
|
||||
doCheck = false;
|
||||
propagatedBuildInputs = with ocamlPackages; [
|
||||
async
|
||||
gluten-async
|
||||
faraday-async
|
||||
async_ssl
|
||||
] ++ [ h2Pkgs.h2 ];
|
||||
};
|
||||
|
||||
h2-mirage = buildDunePackage {
|
||||
pname = "h2-mirage";
|
||||
inherit version;
|
||||
src = with nix-filter; filter {
|
||||
root = ./..;
|
||||
include = [ "dune-project" "mirage" "h2-mirage.opam" ];
|
||||
};
|
||||
|
||||
doCheck = false;
|
||||
propagatedBuildInputs = with ocamlPackages; [
|
||||
conduit-mirage
|
||||
gluten-mirage
|
||||
] ++ [ h2Pkgs.h2-lwt ];
|
||||
};
|
||||
|
||||
};
|
||||
in
|
||||
|
||||
h2Pkgs // (if lib.versionOlder "5.0" ocaml.version then {
|
||||
h2-eio = buildDunePackage {
|
||||
pname = "h2-eio";
|
||||
inherit version;
|
||||
src = with nix-filter; filter {
|
||||
root = ./..;
|
||||
include = [ "dune-project" "eio" "h2-eio.opam" ];
|
||||
};
|
||||
|
||||
propagatedBuildInputs = with ocamlPackages; [ gluten-eio ] ++ [ h2Pkgs.h2 ];
|
||||
};
|
||||
|
||||
} else { })
|
||||
40
unikernel/duniverse/ocaml-h2/nix/shell.nix
Normal file
40
unikernel/duniverse/ocaml-h2/nix/shell.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ packages
|
||||
, mkShell
|
||||
, stdenv
|
||||
, lib
|
||||
, cacert
|
||||
, curl
|
||||
, ocamlPackages
|
||||
, git
|
||||
, h2spec
|
||||
, release-mode ? false
|
||||
}:
|
||||
|
||||
let
|
||||
h2Drvs = lib.filterAttrs (_: value: lib.isDerivation value) packages;
|
||||
|
||||
in
|
||||
|
||||
|
||||
(mkShell {
|
||||
inputsFrom = lib.attrValues h2Drvs;
|
||||
buildInputs =
|
||||
(if release-mode then [
|
||||
cacert
|
||||
curl
|
||||
ocamlPackages.dune-release
|
||||
git
|
||||
] else [ ])
|
||||
++ (with ocamlPackages; [
|
||||
merlin
|
||||
ocamlformat
|
||||
utop
|
||||
h2spec
|
||||
httpun-lwt-unix
|
||||
tls-lwt
|
||||
]);
|
||||
}).overrideAttrs (o: {
|
||||
propagatedBuildInputs = lib.filter
|
||||
(drv: drv.pname == null || !(lib.any (name: name == drv.pname) (lib.attrNames h2Drvs)))
|
||||
o.propagatedBuildInputs;
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue