diff --git a/README.md b/README.md index 47547832b3cfaed07d528811a6ccd1af28fff198..4b7c5fc9529f3432166843260789b6e6a48cada1 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,31 @@ To run the CAISAR [Docker](https://www.docker.com/) image, do the following: docker run -it laiser/caisar:pub sh ``` +### Nix flake +A CAISAR Nix flake allow for reproducible build, and setting up a development +environment. It requires Nix version 2.15 or higher as well as enabling flakes. +Please refer to the official Nix [documentation](https://nixos.wiki/wiki/Flakes#Temporary) to enable Nix flakes. + +Assuming you have Nix installed and are at the CAISAR repository root, you can +build CAISAR using the following command: + +``` +nix build +``` + +You can setup a development environment with all CAISAR dependencies +included using [nix develop](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html). +It will contain the ocaml toolchain already setup and installed, +and the ocaml language server and formatter. You can thus compile and test +CAISAR in an isolated shell using the following command: + +``` +nix develop +``` + ### From source code -**Please note:** CAISAR requires the OCaml package manager [opam](https://opam.ocaml.org/), +**Please note:** building CAISAR from source requires the OCaml package manager [opam](https://opam.ocaml.org/), v2.1 or higher, which is typically avaible in all major GNU/Linux distributions. To build and install CAISAR, do the following: diff --git a/doc/installation.rst b/doc/installation.rst index b5df738d5b3deb10e76fe34afed02056dd462c5d..62199f954fef870d5739735ae668254ee4b7b3ae 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -53,6 +53,54 @@ To run the CAISAR Docker image, do the following: $ docker run -it laiser/caisar:pub sh +Install through Nix +------------------- + +This method requires Nix (version 2.15 or above) to be installed on your system. + +From Nixpkgs +************ + +CAISAR is currently not directly available on Nixpkgs. This should change for +the future release. + +Using Nix flake +*************** + +A CAISAR `flake <https://nixos.wiki/wiki/Flakes>`_ is available at the root of +CAISAR directory. At the time of writing, flakes are still considered +experimental by NixOS. Hence, to use it, you will need to enable them following +the official Nix `instructions <https://nixos.wiki/wiki/Flakes#Temporary>`_. + +Assuming you have Nix installed and are at the CAISAR repository root, you can +build CAISAR using the following command: + +.. code-block:: console + + $ nix build + +.. warning :: + This command will fetch the Nixpkg registry for all build dependencies. + This will result in several megabytes download. Make sure you have + a stable network connexion before attempting building through Nix. + +The CAISAR binary will reside in ``result/bin/caisar``. The manual will be under ``result/share/doc/ocaml4.14.1-caisar-0.2.0/``. + +You can run the CAISAR test suite using the following command: + +.. code-block:: console + + $ nix flake check + +You can setup a development environment with all CAISAR dependencies included using +`nix develop +<https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html>`_. +It will contain the ocaml toolchain already setup and installed, and the ocaml language server and formatter. You can thus compile and test CAISAR in an isolated shell. + +.. code-block :: console + + $ nix develop + Compile from source ------------------- diff --git a/flake.nix b/flake.nix index 653336b4ae1e0675187bc92162f5545aadaa7f3d..6e53abeef34480f6f5dc75ac2269e0215b251b3b 100644 --- a/flake.nix +++ b/flake.nix @@ -34,8 +34,7 @@ in rec { packages = rec { - <<<<<<< HEAD - default = self.packages.${system}.caisar; + default = self.packages.${system}.caisar; # CAISAR package; includes binary and documentation caisar = ocamlPkgs.buildDunePackage {