diff --git a/pkgs/build-support/ocaml/topkg.nix b/pkgs/build-support/ocaml/topkg.nix new file mode 100644 index 000000000000..73be5815e44c --- /dev/null +++ b/pkgs/build-support/ocaml/topkg.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, fetchurl, ocaml, findlib, topkg, ocamlbuild, cmdliner, odoc, b0 +}: + +{ pname, version, nativeBuildInputs ? [ ], buildInputs ? [ ], ... }@args: + +lib.throwIf (args ? minimalOCamlVersion + && lib.versionOlder ocaml.version args.minimalOCamlVersion) +"${pname}-${version} is not available for OCaml ${ocaml.version}" + +stdenv.mkDerivation ({ + + dontAddStaticConfigureFlags = true; + configurePlatforms = [ ]; + strictDeps = true; + inherit (topkg) buildPhase installPhase; + +} // (builtins.removeAttrs args [ "minimalOCamlVersion" ]) // { + + name = "ocaml${ocaml.version}-${pname}-${version}"; + + nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ] ++ nativeBuildInputs; + buildInputs = [ topkg ] ++ buildInputs; + + meta = (args.meta or { }) // { + platforms = args.meta.platforms or ocaml.meta.platforms; + }; + +}) diff --git a/pkgs/development/ocaml-modules/b0/default.nix b/pkgs/development/ocaml-modules/b0/default.nix new file mode 100644 index 000000000000..e3c21c31e689 --- /dev/null +++ b/pkgs/development/ocaml-modules/b0/default.nix @@ -0,0 +1,46 @@ +{ lib, stdenv, fetchurl, ocaml, findlib, topkg, ocamlbuild, cmdliner }: + +let + +in lib.throwIfNot (lib.versionAtLeast ocaml.version "4.08") +"b0 is not available for OCaml ${ocaml.version}" + +stdenv.mkDerivation rec { + + pname = "ocaml${ocaml.version}-b0"; + version = "0.0.5"; + + src = fetchurl { + url = "${meta.homepage}/releases/b0-${version}.tbz"; + sha256 = "sha256-ty04JQcP4RCme/VQw0ko2IBebWWX5cBU6nRTTeV1I/I="; + }; + + strictDeps = true; + + nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ]; + buildInputs = [ topkg cmdliner ]; + + inherit (topkg) buildPhase installPhase; + + meta = with lib; { + description = "Software construction and deployment kit"; + longDescription = '' + WARNING this package is unstable and work in progress, do not depend on + it. + B0 describes software construction and deployments using modular and + customizable definitions written in OCaml. B0 describes: + * Build environments. + * Software configuration, build and testing. + * Source and binary deployments. + * Software life-cycle procedures. + B0 also provides the B00 build library which provides abitrary build + abstraction with reliable and efficient incremental rebuilds. The B00 + library can be – and has been – used on its own to devise domain specific + build systems. + ''; + homepage = "https://erratique.ch/software/b0"; + inherit (ocaml.meta) platforms; + license = licenses.isc; + maintainers = [ maintainers.Julow ]; + }; +} diff --git a/pkgs/development/ocaml-modules/odig/default.nix b/pkgs/development/ocaml-modules/odig/default.nix new file mode 100644 index 000000000000..5ea3730c7ff4 --- /dev/null +++ b/pkgs/development/ocaml-modules/odig/default.nix @@ -0,0 +1,25 @@ +{ lib, stdenv, fetchurl, buildTopkgPackage, cmdliner, odoc, b0 }: + +buildTopkgPackage rec { + pname = "odig"; + version = "0.0.9"; + + src = fetchurl { + url = "${meta.homepage}/releases/odig-${version}.tbz"; + sha256 = "sha256-sYKvGYkxeF5FmrNQdOyMAtlsJqhlmUESi9SkPn/cjM4="; + }; + + buildInputs = [ cmdliner odoc b0 ]; + + meta = with lib; { + description = "Lookup documentation of installed OCaml packages"; + longDescription = '' + odig is a command line tool to lookup documentation of installed OCaml + packages. It shows package metadata, readmes, change logs, licenses, + cross-referenced `odoc` API documentation and manuals. + ''; + homepage = "https://erratique.ch/software/odig"; + license = licenses.isc; + maintainers = [ maintainers.Julow ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 63f4156e3bbe..c01b5f225476 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16865,6 +16865,8 @@ with pkgs; ocamlformat_0_22_4 ocamlformat_0_23_0 ocamlformat_0_24_1 ocamlformat_0_25_1 ocamlformat_0_26_0; + inherit (ocamlPackages) odig; + orc = callPackage ../development/compilers/orc { }; orocos-kdl = callPackage ../development/libraries/orocos-kdl { }; diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index e6cbbec2da74..71fc1d9a460f 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -60,6 +60,8 @@ let ### B ### + b0 = callPackage ../development/ocaml-modules/b0 { }; + bap = janeStreet_0_15.bap; base64 = callPackage ../development/ocaml-modules/base64 { }; @@ -1330,6 +1332,8 @@ let odate = callPackage ../development/ocaml-modules/odate { }; + odig = callPackage ../development/ocaml-modules/odig { }; + odoc = callPackage ../development/ocaml-modules/odoc { }; odoc-parser = callPackage ../development/ocaml-modules/odoc-parser { }; @@ -1888,6 +1892,8 @@ let buildOasisPackage = callPackage ../build-support/ocaml/oasis.nix { }; + buildTopkgPackage = callPackage ../build-support/ocaml/topkg.nix { }; + # Apps from all-packages, to be eventually removed google-drive-ocamlfuse = callPackage ../applications/networking/google-drive-ocamlfuse { };