This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,31 @@
{ 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}";
})
];
};
in
pkgs.callPackage ./.. {
inherit nix-filter;
doCheck = true;
}

View file

@ -0,0 +1,117 @@
{ nix-filter, lib, stdenv, ocamlPackages, doCheck ? true }:
with ocamlPackages;
let
genSrc = { dirs, files }:
with nix-filter; filter {
root = ./..;
include = [ "dune-project" ] ++ files ++ (builtins.map inDirectory dirs);
};
buildHttpun = args: buildDunePackage ({
version = "0.6.5-dev";
doCheck = doCheck;
} // args);
httpunPkgs = rec {
httpun-types = buildHttpun {
pname = "httpun-types";
src = genSrc {
dirs = [ "types" ];
files = [ "httpun-types.opam" ];
};
propagatedBuildInputs = [ faraday ];
};
httpun = buildHttpun {
pname = "httpun";
src = genSrc {
dirs = [ "lib" "lib_test" ];
files = [ "httpun.opam" ];
};
buildInputs = [ alcotest hex yojson ];
propagatedBuildInputs = [
angstrom
faraday
httpun-types
];
};
# These two don't have tests
httpun-lwt = buildHttpun {
pname = "httpun-lwt";
src = genSrc {
dirs = [ "lwt" ];
files = [ "httpun-lwt.opam" ];
};
doCheck = false;
propagatedBuildInputs = [ gluten-lwt httpun lwt ];
};
httpun-lwt-unix = buildHttpun {
pname = "httpun-lwt-unix";
src = genSrc {
dirs = [ "lwt-unix" ];
files = [ "httpun-lwt-unix.opam" ];
};
doCheck = false;
propagatedBuildInputs = [
gluten-lwt-unix
httpun-lwt
faraday-lwt-unix
lwt_ssl
];
};
httpun-async = buildHttpun {
pname = "httpun-async";
src = genSrc {
dirs = [ "async" ];
files = [ "httpun-async.opam" ];
};
doCheck = false;
propagatedBuildInputs = [
httpun
async
gluten-async
faraday-async
async_ssl
];
};
httpun-mirage = buildHttpun {
pname = "httpun-mirage";
src = genSrc {
dirs = [ "mirage" ];
files = [ "httpun-mirage.opam" ];
};
doCheck = false;
propagatedBuildInputs = [
faraday-lwt
conduit-mirage
httpun-lwt
gluten-mirage
];
};
};
in
with httpunPkgs;
httpunPkgs // (if lib.versionOlder "5.0" ocaml.version then {
httpun-eio = buildHttpun {
pname = "httpun-eio";
src = genSrc {
dirs = [ "eio" ];
files = [ "httpun-eio.opam" ];
};
propagatedBuildInputs = [
httpun
gluten-eio
eio
];
};
} else { })

View file

@ -0,0 +1,32 @@
{ pkgs
, packages
, stdenv
, lib
, release-mode ? false
}:
let
httpunDrvs = lib.filterAttrs (_: value: lib.isDerivation value) packages;
in
with pkgs;
(mkShell {
OCAMLRUNPARAM = "b";
nativeBuildInputs =
lib.optionals release-mode [
cacert
curl
ocamlPackages.dune-release
git
];
inputsFrom = lib.attrValues httpunDrvs;
buildInputs = with ocamlPackages; [ merlin utop ];
}).overrideAttrs (o: {
propagatedBuildInputs = lib.filter
(drv:
!(lib.hasAttr "pname" drv) ||
drv.pname == null ||
!(lib.any (name: name == drv.pname) (lib.attrNames httpunDrvs)))
o.propagatedBuildInputs;
})