diff --git a/README.md b/README.md index 7fb0e2f..3b39fec 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ Once your preferred template has been initialized, you can use the provided shel | [Nim] | [`nim`](./nim/) | | [Nix] | [`nix`](./nix/) | | [Node.js][node] | [`node`](./node/) | +| [OCaml] | [`ocaml`](./ocaml/) | | [Open Policy Agent][opa] | [`opa`](./opa) | | [Protobuf] | [`protobuf`](./protobuf/) | | [Ruby] | [`ruby`](./ruby/) | @@ -162,6 +163,13 @@ The sections below list what each template includes. In all cases, you're free t - [Yarn] 1.22.19 - [node2nix] 1.11.1 +### [`ocaml`](./ocaml/) + +- [OCaml] 4.13.1 +- [Dune] 3.4.1 +- [odoc] 2.1.1 +- [ocamlformat] 0.24.0 + ### [`opa`](./opa/) - [Open Policy Agent][opa] 0.43.0 @@ -236,6 +244,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T [dhall-to-nix]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-nix [dhall-toml]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-toml [dhall-yaml]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-yaml +[dune]: https://dune.build [elixir]: https://elixir-lang.org [elm]: https://elm-lang.org [elm2nix]: https://github.com/cachix/elm2nix @@ -273,6 +282,9 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T [nomad-autoscaler]: TOhttps://github.com/hashicorp/nomad-autoscaler [nomad-pack]: https://github.com/hashicorp/nomad-pack [npm]: https://npmjs.org +[ocaml]: https://ocaml.org +[ocamlformat]: https://github.com/ocaml-ppx/ocamlformat +[odoc]: https://github.com/ocaml/odoc [opa]: https://openpolicyagent.org [packer]: https://packer.io [pip]: https://pypi.org/project/pip diff --git a/ocaml/.envrc b/ocaml/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/ocaml/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/ocaml/flake.lock b/ocaml/flake.lock new file mode 100644 index 0000000..3d3c452 --- /dev/null +++ b/ocaml/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "dev": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1660137916, + "narHash": "sha256-7+DP5n6r2qULQzxd8dI6ghjMDG47Mpdw1lPYaoB/LYA=", + "owner": "the-nix-way", + "repo": "dev-templates", + "rev": "ada54b20ccc42e53edd8a6a3cc2b56a6a4006d07", + "type": "github" + }, + "original": { + "owner": "the-nix-way", + "repo": "dev-templates", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1660137298, + "narHash": "sha256-CjWK2qop+j0e/8gRqtSpIizX2EM5YbtR36Db5dhFs94=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f2f95b120bda675c3eba6d6bf01360c5b9a78e9c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "dev": "dev" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/ocaml/flake.nix b/ocaml/flake.nix new file mode 100644 index 0000000..7f79d05 --- /dev/null +++ b/ocaml/flake.nix @@ -0,0 +1,26 @@ +{ + description = "A Nix-flake-based OCaml development environment"; + + inputs = { dev.url = "github:the-nix-way/dev-templates"; }; + + outputs = { self, dev }: + let inherit (dev.lib) flake-utils nixpkgs; + in flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + inherit (pkgs) mkShell; + ocaml = pkgs.ocamlPackages.ocaml; + ocamlTools = with pkgs.ocamlPackages; + [ dune_3 odoc ] ++ (with pkgs; [ ocamlformat ]); + in { + devShells = { + default = mkShell { + buildInputs = [ ocaml ] ++ ocamlTools; + + shellHook = '' + ${ocaml}/bin/ocaml --version + ''; + }; + }; + }); +}