diff --git a/pkgs/development/ocaml-modules/reason-native/cli.nix b/pkgs/development/ocaml-modules/reason-native/cli.nix new file mode 100644 index 00000000000..1a4c020dc35 --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/cli.nix @@ -0,0 +1,11 @@ +{ re, reason, pastel, ... }: + +{ + pname = "cli"; + + buildInputs = [ + re + reason + pastel + ]; +} diff --git a/pkgs/development/ocaml-modules/reason-native/console.nix b/pkgs/development/ocaml-modules/reason-native/console.nix new file mode 100644 index 00000000000..c11c12b4673 --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/console.nix @@ -0,0 +1,21 @@ +{ buildDunePackage, callPackage, reason, console, ... }: + +{ + pname = "console"; + + buildInputs = [ + reason + ]; + + passthru.tests = { + console = callPackage ./tests/console { + inherit buildDunePackage reason console; + }; + }; + + meta = { + description = "A library providing a web-influenced polymorphic console API for native Console.log(anything) with runtime printing"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/console"; + homepage = "https://reason-native.com/docs/console/"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/default.nix b/pkgs/development/ocaml-modules/reason-native/default.nix new file mode 100644 index 00000000000..f65aa5159b9 --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/default.nix @@ -0,0 +1,43 @@ +{ newScope, lib, fetchFromGitHub, callPackage, buildDunePackage, atdgen, junit, qcheck-core, re, reason, reason-native }: + +let + generic = (somePath: + let + prepkg = import somePath { + inherit callPackage cli buildDunePackage atdgen junit qcheck-core re reason; + inherit (reason-native) console file-context-printer fp pastel rely; + }; + in + buildDunePackage + ({ + version = "2021-16-16-aec0ac6"; + src = fetchFromGitHub { + owner = "reasonml"; + repo = "reason-native"; + rev = "aec0ac681be7211b4d092262281689c46deb63e1"; + sha256 = "sha256-QoyI50MBY3RJBmM1y90n7oXrLmHe0CQxKojv+7YbegE="; + }; + useDune2 = true; + meta = with lib; { + description = "Libraries for building and testing native Reason programs"; + downloadPage = "https://github.com/reasonml/reason-native"; + homepage = "https://reason-native.com/"; + license = licenses.mit; + maintainers = with maintainers; [ superherointj ]; + } // (prepkg.meta or {}); + } // prepkg) + ); + cli = generic ./cli.nix; # Used only by Rely. +in + lib.makeScope newScope (self: with self; { + console = generic ./console.nix; + dir = generic ./dir.nix; + file-context-printer = generic ./file-context-printer.nix; + fp = generic ./fp.nix; + pastel = generic ./pastel.nix; + pastel-console = generic ./pastel-console.nix; + qcheck-rely = generic ./qcheck-rely.nix; + refmterr = generic ./refmterr.nix; + rely = generic ./rely.nix; + rely-junit-reporter = generic ./rely-junit-reporter.nix; + }) diff --git a/pkgs/development/ocaml-modules/reason-native/dir.nix b/pkgs/development/ocaml-modules/reason-native/dir.nix new file mode 100644 index 00000000000..e6eb9c0c403 --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/dir.nix @@ -0,0 +1,18 @@ +{ reason, fp, ... }: + +{ + pname = "dir"; + + buildInputs = [ + reason + ]; + + propagatedBuildInputs = [ + fp + ]; + + meta = { + description = "A library that provides a consistent API for common system, user and application directories consistently on all platforms"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/dir"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/file-context-printer.nix b/pkgs/development/ocaml-modules/reason-native/file-context-printer.nix new file mode 100644 index 00000000000..749e727feec --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/file-context-printer.nix @@ -0,0 +1,20 @@ +{ reason, re, pastel, ... }: + +{ + pname = "file-context-printer"; + + buildInputs = [ + reason + ]; + + propagatedBuildInputs = [ + re + pastel + ]; + + meta = { + description = "Utility for displaying snippets of files on the command line"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/file-context-printer"; + homepage = "https://reason-native.com/docs/file-context-printer/"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/fp.nix b/pkgs/development/ocaml-modules/reason-native/fp.nix new file mode 100644 index 00000000000..ae6ae50705d --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/fp.nix @@ -0,0 +1,14 @@ +{ reason, ... }: + +{ + pname = "fp"; + + buildInputs = [ + reason + ]; + + meta = { + description = "A library for creating and operating on file paths consistently on multiple platforms"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/fp"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/pastel-console.nix b/pkgs/development/ocaml-modules/reason-native/pastel-console.nix new file mode 100644 index 00000000000..f1d2c7cc726 --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/pastel-console.nix @@ -0,0 +1,20 @@ +{ reason, console, pastel, ... }: + +{ + pname = "pastel-console"; + + buildInputs = [ + reason + ]; + + propagatedBuildInputs = [ + console + pastel + ]; + + meta = { + description = "Small library for pretty coloring to Console output"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/pastel-console"; + homepage = "https://reason-native.com/docs/pastel/console"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/pastel.nix b/pkgs/development/ocaml-modules/reason-native/pastel.nix new file mode 100644 index 00000000000..a5abc4e219c --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/pastel.nix @@ -0,0 +1,20 @@ +{ reason, re, ... }: + +{ + pname = "pastel"; + + minimalOCamlVersion = "4.05"; + + buildInputs = [ + reason + ]; + propagatedBuildInputs = [ + re + ]; + + meta = { + description = "A text formatting library that harnesses Reason JSX to provide intuitive terminal output. Like React but for CLI"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/pastel"; + homepage = "https://reason-native.com/docs/pastel/"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/qcheck-rely.nix b/pkgs/development/ocaml-modules/reason-native/qcheck-rely.nix new file mode 100644 index 00000000000..a3d297b4f5a --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/qcheck-rely.nix @@ -0,0 +1,20 @@ +{ qcheck-core, reason, console, rely, ... }: + +{ + pname = "qcheck-rely"; + + buildInputs = [ + reason + ]; + + propagatedBuildInputs = [ + qcheck-core + console + rely + ]; + + meta = { + description = "A library containing custom Rely matchers allowing for easily using QCheck with Rely. QCheck is a 'QuickCheck inspired property-based testing for OCaml, and combinators to generate random values to run tests on'"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/qcheck-rely"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/refmterr.nix b/pkgs/development/ocaml-modules/reason-native/refmterr.nix new file mode 100644 index 00000000000..9b14d4a8ba3 --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/refmterr.nix @@ -0,0 +1,21 @@ +{ atdgen, re, reason, pastel, ... }: + +{ + pname = "refmterr"; + + buildInputs = [ + reason + ]; + + propagatedBuildInputs = [ + atdgen + re + pastel + ]; + + meta = { + description = "An error formatter tool for Reason and OCaml. Takes raw error output from compiler and converts to pretty output"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/refmterr"; + homepage = "https://reason-native.com/docs/refmterr/"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/rely-junit-reporter.nix b/pkgs/development/ocaml-modules/reason-native/rely-junit-reporter.nix new file mode 100644 index 00000000000..6e8b41bbd1c --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/rely-junit-reporter.nix @@ -0,0 +1,23 @@ +{ atdgen, junit, re, reason, pastel, rely, ... }: + +{ + pname = "rely-junit-reporter"; + + buildInputs = [ + atdgen + reason + ]; + + propagatedBuildInputs = [ + junit + re + pastel + rely + ]; + + meta = { + description = "A tool providing JUnit Reporter for Rely Testing Framework"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/rely-junit-reporter"; + homepage = "https://reason-native.com/docs/rely/"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/rely.nix b/pkgs/development/ocaml-modules/reason-native/rely.nix new file mode 100644 index 00000000000..a2230426bec --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/rely.nix @@ -0,0 +1,22 @@ +{ re, reason, cli, file-context-printer, pastel, ... }: + +{ + pname = "rely"; + + buildInputs = [ + reason + ]; + + propagatedBuildInputs = [ + re + cli + file-context-printer + pastel + ]; + + meta = { + description = "A Jest-inspired testing framework for native OCaml/Reason"; + downloadPage = "https://github.com/reasonml/reason-native/tree/master/src/rely"; + homepage = "https://reason-native.com/docs/rely/"; + }; +} diff --git a/pkgs/development/ocaml-modules/reason-native/tests/console/console-test.opam b/pkgs/development/ocaml-modules/reason-native/tests/console/console-test.opam new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pkgs/development/ocaml-modules/reason-native/tests/console/console-test.re b/pkgs/development/ocaml-modules/reason-native/tests/console/console-test.re new file mode 100644 index 00000000000..15685205e1b --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/tests/console/console-test.re @@ -0,0 +1 @@ +Console.log(Some("Hello fellow Nixer!")); /* {"Hello fellow Nixer!"} */ diff --git a/pkgs/development/ocaml-modules/reason-native/tests/console/default.nix b/pkgs/development/ocaml-modules/reason-native/tests/console/default.nix new file mode 100644 index 00000000000..e1a995d33c5 --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/tests/console/default.nix @@ -0,0 +1,20 @@ +{ lib, buildDunePackage, reason, console }: + +buildDunePackage rec { + pname = "console-test"; + version = "1"; + + src = ./.; + + useDune2 = true; + + buildInputs = [ + reason + console + ]; + + doInstallCheck = true; + postInstallCheck = '' + $out/bin/console-test | grep -q "{\"Hello fellow Nixer!\"}" > /dev/null + ''; +} diff --git a/pkgs/development/ocaml-modules/reason-native/tests/console/dune b/pkgs/development/ocaml-modules/reason-native/tests/console/dune new file mode 100644 index 00000000000..49f2121385e --- /dev/null +++ b/pkgs/development/ocaml-modules/reason-native/tests/console/dune @@ -0,0 +1,4 @@ +(executable + (name console-test) + (public_name console-test) + (libraries reason console.lib)) diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 9168661a75b..07191c8e96f 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -1144,6 +1144,8 @@ let reason = callPackage ../development/compilers/reason { }; + reason-native = lib.recurseIntoAttrs (callPackage ../development/ocaml-modules/reason-native { }); + rope = callPackage ../development/ocaml-modules/rope { }; rpclib = callPackage ../development/ocaml-modules/rpclib { };