Add OCaml env

This commit is contained in:
Luc Perkins 2022-08-13 18:10:46 +03:00
parent ada54b20cc
commit af52a64341
No known key found for this signature in database
GPG key ID: 4F102D0C16E232F2
4 changed files with 99 additions and 0 deletions

View file

@ -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

1
ocaml/.envrc Normal file
View file

@ -0,0 +1 @@
use flake .

60
ocaml/flake.lock Normal file
View file

@ -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
}

26
ocaml/flake.nix Normal file
View file

@ -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
'';
};
};
});
}