Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 15 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,81 +45,24 @@ competitors if your project requires:

## Documentation

- [Design](./docs/design.md),
- [Compiler](./docs/compiler.md),
- [Codegen](./docs/codegen.md),
- [Comparison matrix](./docs/comparison-matrix.md),
- [User feedback](.docs/feedback)
Visit [LambdaBuffers Github Pages](https://mlabs-haskell.github.io/lambda-buffers).

## Getting started
## Acknowledgements

### Installing Nix
This project was graciously funded by the Cardano Treasury in [Catalyst Fund 9](https://cardano.ideascale.com/c/idea/421376).

This repository relies heavily on the [Nix Package
Manager](https://nixos.org/download.html) for both development and package
distribution.
Authors:

To install run the following command:
- [Drazen Popovic](https://github.com/bladyjoker)
- [Vlad Posmangiu Luchian](https://github.com/cstml)
- [Sean Hunter](https://github.com/gnumonik)

```sh
sh <(curl -L https://nixos.org/nix/install) --daemon
```
Contributors:

and follow the instructions.

```sh
$ nix --version
nix (Nix) 2.8.0
```

> NOTE: The repository should work with Nix version greater or equal to 2.8.0.

Make sure to enable [Nix Flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes)
and IFD by editing either `~/.config/nix/nix.conf` or `/etc/nix/nix.conf` on
your machine and add the following configuration entries:

```yaml
experimental-features = nix-command flakes
allow-import-from-derivation = true
```

Optionally, to improve build speed, it is possible to set up a binary caches
maintained by IOHK and Plutonomicon by setting additional configuration entries:

```yaml
substituters = https://cache.nixos.org https://iohk.cachix.org https://cache.iog.io https://public-plutonomicon.cachix.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= public-plutonomicon.cachix.org-1:3AKJMhCLn32gri1drGuaZmFrmnue+KkKrhhubQk/CWc=
```

### Building and development

To facilitate seamlessly moving between directories and associated Nix
development shells we use [direnv](https://direnv.net) and
[nix-direnv](https://github.com/nix-community/nix-direnv):

To install both using `nixpkgs`:

```sh
nix profile install nixpkgs#direnv
nix profile install nixpkgs#nix-direnv
```

Your shell and editors should pick up on the `.envrc` files in different
directories and prepare the environment accordingly. Use `direnv allow` to
enable the direnv environment and `direnv reload` to reload it when necessary.

Additionally, throughout the repository one can use:

```sh
$ pre-commit run --all
cabal-fmt............................................(no files to check)Skipped
fourmolu.................................................................Passed
hlint....................................................................Passed
markdownlint.............................................................Passed
nix-linter...............................................................Passed
nixpkgs-fmt..............................................................Passed
shellcheck...........................................(no files to check)Skipped
typos....................................................................Passed
```

To run all the code quality tooling specified in the [pre-commit-check config file](./pre-commit.nix)
- [George Flerovsky](https://github.com/GeorgeFlerovsky)
- [Andrea Ciceri](https://github.com/aciceri)
- [Julia Chatain](https://juliachatain.com)
- [Andrea Vezzosi](https://github.com/saizan)
- [Magnus Viernickel](https://github.com/MangoIV)
- [Rajdeep Chase Maity](https://github.com/TotallyNotChase)
- [Ramiro Garay](https://github.com/rmgaray)
File renamed without changes.
50 changes: 50 additions & 0 deletions api/build.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ pkgs, pbnix-lib, commonTools, shellHook }:
rec {
devShell = pkgs.mkShell {
name = "protos-env";
buildInputs = [
pkgs.protobuf
pkgs.haskellPackages.proto-lens-protoc
pkgs.protoc-gen-doc
] ++ builtins.attrValues commonTools;

inherit shellHook;
};

packages = {
lambda-buffers-lang-hs-pb = pbnix-lib.haskellProto {
inherit pkgs;
src = ./.;
proto = "lang.proto";
cabalPackageName = "lambda-buffers-lang-pb";
};

lambda-buffers-compiler-hs-pb = pbnix-lib.haskellProto {
inherit pkgs;
src = ./.;
proto = "compiler.proto";
cabalBuildDepends = [ packages.lambda-buffers-lang-hs-pb ];
cabalPackageName = "lambda-buffers-compiler-pb";
};

lambda-buffers-codegen-hs-pb = pbnix-lib.haskellProto {
inherit pkgs;
src = ./.;
proto = "codegen.proto";
cabalBuildDepends = [ packages.lambda-buffers-lang-hs-pb ];
cabalPackageName = "lambda-buffers-codegen-pb";
};

lambda-buffers-api-docs = pkgs.stdenv.mkDerivation {
src = ./.;
name = "lambdabuffers-api-docs";
buildInputs = [
pkgs.protobuf
];
buildPhase = ''
mkdir $out;
protoc --plugin=${pkgs.protoc-gen-doc}/bin/protoc-gen-doc lang.proto compiler.proto codegen.proto --doc_out=$out --doc_opt=markdown,api.md;
'';
};
};
}
2 changes: 1 addition & 1 deletion lambda-buffers-proto/codegen.proto → api/codegen.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package lambdabuffers;
package lambdabuffers.codegen;

import "lang.proto";

Expand Down
2 changes: 1 addition & 1 deletion lambda-buffers-proto/compiler.proto → api/compiler.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package lambdabuffers;
package lambdabuffers.compiler;

import "lang.proto";

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Summary

- [Introduction](introduction.md)
- [Getting started](getting-started.md)
- [LambdaBuffers to Haskell](haskell.md)
- [LambdaBuffers to Purescript](purescript.md)
- [Design](design.md)
- [API](api.md)
- [Compiler](compiler.md)
- [Compiler API](compiler-api.md)
- [Codegen](codegen.md)
- [Command line interface](command-line-interface.md)
- [Comparison matrix](comparison-matrix.md)
23 changes: 18 additions & 5 deletions docs/build.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
{ pkgs, commonTools, shellHook }:
pkgs.mkShell {
name = "docs-env";
{ inputs, lib, ... }: {
perSystem = { pkgs, system, inputs', config, ... }:
{
devShells.dev-docs = pkgs.mkShell {
name = "docs-env";
packages = [ pkgs.mdbook ];
shellHook = config.pre-commit.installationScript;
};

packages = [ commonTools.markdownlint-cli commonTools.typos pkgs.mdbook ];
packages.lambda-buffers-book = pkgs.stdenv.mkDerivation {
src = ./.;
name = "lambda-buffers-book";
buildInputs = [ pkgs.mdbook ];
buildPhase = ''
cp ${config.packages.lambda-buffers-api-docs}/api.md api.md;
mdbook build . --dest-dir $out
'';
};

inherit shellHook;
};
}
Loading