diff --git a/pkgs/development/ocaml-modules/arp/default.nix b/pkgs/development/ocaml-modules/arp/default.nix new file mode 100644 index 00000000000..518f1c9f424 --- /dev/null +++ b/pkgs/development/ocaml-modules/arp/default.nix @@ -0,0 +1,57 @@ +{ lib, buildDunePackage, fetchurl +, cstruct, ipaddr, macaddr, logs, lwt, duration +, mirage-time, mirage-protocols, mirage-profile +, alcotest, ethernet, fmt, mirage-vnetif, mirage-random +, mirage-random-test, mirage-clock-unix, mirage-time-unix +, bisect_ppx +}: + +buildDunePackage rec { + pname = "arp"; + version = "2.3.1"; + + minimumOCamlVersion = "4.06"; + + useDune2 = true; + + src = fetchurl { + url = "https://github.com/mirage/${pname}/releases/download/v${version}/${pname}-v${version}.tbz"; + sha256 = "1nzm3fbkvz702g8f60fs49736lpffwchy64i1l1raxm9b4lmdk3p"; + }; + + nativeBuildInputs = [ + bisect_ppx + ]; + + propagatedBuildInputs = [ + cstruct + ipaddr + macaddr + logs + mirage-time + mirage-protocols + lwt + duration + mirage-profile + ]; + + doCheck = true; + checkInputs = [ + alcotest + mirage-profile + mirage-random + mirage-random-test + mirage-vnetif + mirage-clock-unix + mirage-random + mirage-time-unix + ethernet + ]; + + meta = with lib; { + description = "Address Resolution Protocol purely in OCaml"; + license = licenses.isc; + homepage = "https://github.com/mirage/arp"; + maintainers = [ maintainers.sternenseemann ]; + }; +} diff --git a/pkgs/development/ocaml-modules/ethernet/default.nix b/pkgs/development/ocaml-modules/ethernet/default.nix new file mode 100644 index 00000000000..bc4f4a47544 --- /dev/null +++ b/pkgs/development/ocaml-modules/ethernet/default.nix @@ -0,0 +1,42 @@ +{ lib, buildDunePackage, fetchurl +, rresult, cstruct, ppx_cstruct, mirage-net, mirage-protocols +, mirage-profile, macaddr, fmt, lwt, logs +}: + +buildDunePackage rec { + pname = "ethernet"; + version = "2.2.0"; + + minimumOCamlVersion = "4.06"; + + # necessary due to cstruct + useDune2 = true; + + src = fetchurl { + url = "https://github.com/mirage/${pname}/releases/download/v${version}/${pname}-v${version}.tbz"; + sha256 = "0qzisqibx2gd8rh330n642mk5wz229199rnlrs7x8cr5pnymif7z"; + }; + + nativeBuildInputs = [ + ppx_cstruct + ]; + + propagatedBuildInputs = [ + rresult + cstruct + mirage-net + mirage-protocols + macaddr + mirage-profile + fmt + lwt + logs + ]; + + meta = with lib; { + description = "OCaml Ethernet (IEEE 802.3) layer, used in MirageOS"; + homepage = "https://github.com/mirage/ethernet"; + license = licenses.isc; + maintainers = [ maintainers.sternenseemann ]; + }; +} diff --git a/pkgs/development/ocaml-modules/lwt-dllist/default.nix b/pkgs/development/ocaml-modules/lwt-dllist/default.nix new file mode 100644 index 00000000000..59e13330e58 --- /dev/null +++ b/pkgs/development/ocaml-modules/lwt-dllist/default.nix @@ -0,0 +1,26 @@ +{ lib, buildDunePackage, fetchurl, lwt }: + +buildDunePackage rec { + pname = "lwt-dllist"; + version = "1.0.0"; + + minimumOCamlVersion = "4.03"; + + src = fetchurl { + url = "https://github.com/mirage/${pname}/releases/download/v${version}/${pname}-v${version}.tbz"; + sha256 = "0g111f8fq9k1hwccpkhylkp83f73mlz4xnxxr3rf9xpi2f8fh7j9"; + }; + + propagatedBuildInputs = [ + lwt + ]; + + doCheck = true; + + meta = with lib; { + description = "Mutable doubly-linked list with Lwt iterators"; + homepage = "https://github.com/mirage/lwt-dllist"; + license = licenses.mit; + maintainers = [ maintainers.sternenseemann ]; + }; +} diff --git a/pkgs/development/ocaml-modules/mirage-nat/default.nix b/pkgs/development/ocaml-modules/mirage-nat/default.nix new file mode 100644 index 00000000000..5edf8a347ad --- /dev/null +++ b/pkgs/development/ocaml-modules/mirage-nat/default.nix @@ -0,0 +1,50 @@ +{ lib, buildDunePackage, fetchurl +, ipaddr, cstruct, lwt, rresult, logs, lru +, tcpip, ethernet, stdlib-shims +, alcotest, mirage-clock-unix +, ppx_deriving +}: + +buildDunePackage rec { + pname = "mirage-nat"; + version = "2.2.3"; + + minimumOCamlVersion = "4.06"; + + # due to cstruct + useDune2 = true; + + src = fetchurl { + url = "https://github.com/mirage/${pname}/releases/download/v${version}/${pname}-v${version}.tbz"; + sha256 = "0cy95j184hi8fm1h6z6x1brjfrmbq3zjy2mqz99m8ys9vwkb63ma"; + }; + + nativeBuildInputs = [ + ppx_deriving + ]; + + propagatedBuildInputs = [ + ipaddr + cstruct + lwt + rresult + logs + lru + tcpip + ethernet + stdlib-shims + ]; + + doCheck = true; + checkInputs = [ + alcotest + mirage-clock-unix + ]; + + meta = with lib; { + description = "Mirage-nat is a library for network address translation to be used with MirageOS"; + homepage = "https://github.com/mirage/${pname}"; + license = licenses.isc; + maintainers = [ maintainers.sternenseemann ]; + }; +} diff --git a/pkgs/development/ocaml-modules/mirage-random-test/default.nix b/pkgs/development/ocaml-modules/mirage-random-test/default.nix new file mode 100644 index 00000000000..81d75db7725 --- /dev/null +++ b/pkgs/development/ocaml-modules/mirage-random-test/default.nix @@ -0,0 +1,30 @@ +{ lib, buildDunePackage, fetchurl +, cstruct, mirage-random +}: + +buildDunePackage rec { + pname = "mirage-random-test"; + version = "0.1.0"; + + minimumOCamlVersion = "4.06"; + + # due to cstruct + useDune2 = true; + + src = fetchurl { + url = "https://github.com/mirage/${pname}/releases/download/v${version}/${pname}-v${version}.tbz"; + sha256 = "1jmjyb9a4v7l0xxgdwpr9zshzr8xk3hybra6y2dp51anbwk8kv46"; + }; + + propagatedBuildInputs = [ + cstruct + mirage-random + ]; + + meta = with lib; { + description = "Stub random device implementation for testing"; + homepage = "https://github.com/mirage/mirage-random"; + license = licenses.isc; + maintainers = [ maintainers.sternenseemann ]; + }; +} diff --git a/pkgs/development/ocaml-modules/mirage-vnetif/default.nix b/pkgs/development/ocaml-modules/mirage-vnetif/default.nix new file mode 100644 index 00000000000..cafb50309ce --- /dev/null +++ b/pkgs/development/ocaml-modules/mirage-vnetif/default.nix @@ -0,0 +1,40 @@ +{ lib, buildDunePackage, fetchurl +, lwt, mirage-time, mirage-clock, mirage-net +, cstruct, ipaddr, macaddr, mirage-profile +, duration, logs +}: + +buildDunePackage rec { + pname = "mirage-vnetif"; + version = "0.5.0"; + + minimumOCamlVersion = "4.06"; + + # due to cstruct + useDune2 = true; + + src = fetchurl { + url = "https://github.com/mirage/${pname}/releases/download/v${version}/${pname}-v${version}.tbz"; + sha256 = "0cpqwf51v2cpz41dfqxabf3bsabwyl6a0h0v2ncrn33q58i60m5q"; + }; + + propagatedBuildInputs = [ + lwt + mirage-net + mirage-time + mirage-clock + cstruct + ipaddr + macaddr + mirage-profile + duration + logs + ]; + + meta = with lib; { + description = "Virtual network interface and software switch for Mirage"; + homepage = "https://github.com/mirage/${pname}"; + license = licenses.isc; + mantainers = [ maintainers.sternenseemann ]; + }; +} diff --git a/pkgs/development/ocaml-modules/pcap-format/default.nix b/pkgs/development/ocaml-modules/pcap-format/default.nix new file mode 100644 index 00000000000..f8bb6f4f6b2 --- /dev/null +++ b/pkgs/development/ocaml-modules/pcap-format/default.nix @@ -0,0 +1,41 @@ +{ lib, buildDunePackage, fetchurl +, ppx_cstruct, ppx_tools +, cstruct, ounit, mmap +}: + +buildDunePackage rec { + pname = "pcap-format"; + version = "0.5.2"; + + minimumOCamlVersion = "4.03"; + + # due to cstruct + useDune2 = true; + + src = fetchurl { + url = "https://github.com/mirage/ocaml-pcap/releases/download/${version}/${pname}-${version}.tbz"; + sha256 = "14c5rpgglyz41jic0fg0xa22d2w1syb86kva22y9fi7aqj9vm31f"; + }; + + nativeBuildInputs = [ + ppx_tools + ppx_cstruct + ]; + + propagatedBuildInputs = [ + cstruct + ]; + + doCheck = true; + checkInputs = [ + ounit + mmap + ]; + + meta = with lib; { + description = "Decode and encode PCAP (packet capture) files"; + homepage = "https://mirage.github.io/ocaml-pcap"; + license = licenses.isc; + maintainers = [ maintainers.sternenseemann ]; + }; +} diff --git a/pkgs/development/ocaml-modules/tcpip/default.nix b/pkgs/development/ocaml-modules/tcpip/default.nix new file mode 100644 index 00000000000..80fa01066f1 --- /dev/null +++ b/pkgs/development/ocaml-modules/tcpip/default.nix @@ -0,0 +1,70 @@ +{ lib, buildDunePackage, fetchurl +, bisect_ppx, ppx_cstruct +, rresult, cstruct, cstruct-lwt, mirage-net, mirage-clock +, mirage-random, mirage-stack, mirage-protocols, mirage-time +, ipaddr, macaddr, macaddr-cstruct, mirage-profile, fmt +, lwt, lwt-dllist, logs, duration, randomconv, ethernet +, alcotest, mirage-flow, mirage-vnetif, pcap-format +, mirage-clock-unix, arp, ipaddr-cstruct, mirage-random-test +, lru +}: + +buildDunePackage rec { + pname = "tcpip"; + version = "6.0.0"; + + useDune2 = true; + + src = fetchurl { + url = "https://github.com/mirage/mirage-${pname}/releases/download/v${version}/${pname}-v${version}.tbz"; + sha256 = "0wbrs8jz1vw3zdrqmqcwawxh4yhc2gy30rw7gz4w116cblkvnb8s"; + }; + + nativeBuildInputs = [ + bisect_ppx + ppx_cstruct + ]; + + propagatedBuildInputs = [ + rresult + cstruct + cstruct-lwt + mirage-net + mirage-clock + mirage-random + mirage-random-test + mirage-stack + mirage-protocols + mirage-time + ipaddr + macaddr + macaddr-cstruct + mirage-profile + fmt + lwt + lwt-dllist + logs + duration + randomconv + ethernet + lru + ]; + + doCheck = true; + checkInputs = [ + alcotest + mirage-flow + mirage-vnetif + pcap-format + mirage-clock-unix + arp + ipaddr-cstruct + ]; + + meta = with lib; { + description = "OCaml TCP/IP networking stack, used in MirageOS"; + homepage = "https://github.com/mirage/mirage-tcpip"; + maintainers = [ maintainers.sternenseemann ]; + license = licenses.isc; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 02110607734..453a2e6d4c3 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -34,6 +34,8 @@ let apron = callPackage ../development/ocaml-modules/apron { }; + arp = callPackage ../development/ocaml-modules/arp { }; + asn1-combinators = callPackage ../development/ocaml-modules/asn1-combinators { }; astring = callPackage ../development/ocaml-modules/astring { }; @@ -284,6 +286,8 @@ let estring = callPackage ../development/ocaml-modules/estring { }; + ethernet = callPackage ../development/ocaml-modules/ethernet { }; + ezjsonm = callPackage ../development/ocaml-modules/ezjsonm { }; ezxmlm = callPackage ../development/ocaml-modules/ezxmlm { }; @@ -515,6 +519,8 @@ let lwt_camlp4 = callPackage ../development/ocaml-modules/lwt/camlp4.nix { }; + lwt-dllist = callPackage ../development/ocaml-modules/lwt-dllist { }; + lwt_log = callPackage ../development/ocaml-modules/lwt_log { }; lwt_ppx = callPackage ../development/ocaml-modules/lwt/ppx.nix { }; @@ -597,6 +603,8 @@ let mirage-logs = callPackage ../development/ocaml-modules/mirage-logs { }; + mirage-nat = callPackage ../development/ocaml-modules/mirage-nat { }; + mirage-net = callPackage ../development/ocaml-modules/mirage-net { }; mirage-profile = callPackage ../development/ocaml-modules/mirage-profile { }; @@ -605,6 +613,8 @@ let mirage-random = callPackage ../development/ocaml-modules/mirage-random { }; + mirage-random-test = callPackage ../development/ocaml-modules/mirage-random-test { }; + mirage-runtime = callPackage ../development/ocaml-modules/mirage/runtime.nix { }; mirage-stack = callPackage ../development/ocaml-modules/mirage-stack { }; @@ -619,6 +629,8 @@ let mirage-unix = callPackage ../development/ocaml-modules/mirage-unix { }; + mirage-vnetif = callPackage ../development/ocaml-modules/mirage-vnetif { }; + mlgmp = callPackage ../development/ocaml-modules/mlgmp { }; mlgmpidl = callPackage ../development/ocaml-modules/mlgmpidl { }; @@ -802,6 +814,8 @@ let parse-argv = callPackage ../development/ocaml-modules/parse-argv { }; + pcap-format = callPackage ../development/ocaml-modules/pcap-format { }; + pgsolver = callPackage ../development/ocaml-modules/pgsolver { }; phylogenetics = callPackage ../development/ocaml-modules/phylogenetics { }; @@ -840,6 +854,8 @@ let spacetime_lib = callPackage ../development/ocaml-modules/spacetime_lib { }; + tcpip = callPackage ../development/ocaml-modules/tcpip { }; + tsort = callPackage ../development/ocaml-modules/tsort { }; tuntap = callPackage ../development/ocaml-modules/tuntap { };