Skip to content

Commit

Permalink
Project can now be build with Haskell Stack. Instructions were added …
Browse files Browse the repository at this point in the history
…to README on how to do so.
  • Loading branch information
koslambrou committed May 13, 2021
1 parent 1e51a89 commit e93765d
Show file tree
Hide file tree
Showing 5 changed files with 775 additions and 5 deletions.
23 changes: 18 additions & 5 deletions README.md
Expand Up @@ -27,15 +27,13 @@ Alternatively, use the Cabal+Nix build if you want to develop with incremental b

Set up your machine to build things with `Nix`, following the [Plutus README](https://github.com/input-output-hk/plutus/blob/master/README.adoc) (make sure to set up the binary cache!).

To enter a development environment, simply open a terminal on the project's root and use `nix-shell` to get a bash shell:
To enter a development environment, simply open a terminal on the project's root and use `nix-shell` to get a bash shell (expect it to build for ~30 minutes):

```
$ nix-shell
```

Expect it to build for ~30 minutes.

Otherwise, you can use [direnv](https://github.com/direnv/direnv) which allows you to use your preferred shell. Once installed, just run:
Otherwise, you can use [direnv](https://github.com/direnv/direnv) which allows you to use your preferred shell. Once `direnv` is installed, run:

```
$ echo "use nix" > .envrc # Or manually add "use nix" in .envrc if you already have one
Expand All @@ -44,11 +42,24 @@ $ direnv allow

and you'll have a working development environment for now and the future whenever you enter this directory.

The command `cabal build` from the terminal should work.
Now, the command `cabal build` from the terminal should work.

Also included in the environment is a working [Haskell Language Server](https://github.com/haskell/haskell-language-server) you can integrate with your editor.
See [here](https://github.com/haskell/haskell-language-server#configuring-your-editor) for instructions.

### Stack

Another way would be to build this project with [Haskell Stack](https://haskellstack.org/).

```
stack build
```

Our `Haskell Stack` build uses `Nix` in order to install the non-Haskell dependencies needed by the project.
If you don't have `Nix` installed, then you may need to install `gmp` and `zlib` development libraries for the build to succeed.

Expect it to build for ~1 hour.

## The Plutus Application Backend (PAB) example

We have provided an example PAB application in `./pab`. With the PAB we can serve and interact
Expand All @@ -63,12 +74,14 @@ have `jq` installed.

```
cabal build plutus-starter-pab
# or `stack build` if using Haskell Stack
```

2. Run the PAB binary:

```
cabal exec -- plutus-starter-pab
# or `stack run` if using Haskell Stack
````

This will then start up the server on port 8080. The devcontainer process will then automatically expose this port so that you can connect to it from any terminal (it doesn't have to be a terminal running in the devcontainer).
Expand Down
2 changes: 2 additions & 0 deletions default.nix
Expand Up @@ -17,6 +17,8 @@ let
haskellNix.nixpkgsArgs;

in pkgs.haskell-nix.project {
projectFileName = "cabal.project";

# 'cleanGit' cleans a source directory based on the files known by git
src = pkgs.haskell-nix.haskellLib.cleanGit {
name = "plutus-starter";
Expand Down
2 changes: 2 additions & 0 deletions shell.nix
Expand Up @@ -23,6 +23,8 @@ in
project.shellFor {
packages = ps: lib.attrValues (selectProjectPackages ps);

buildInputs = with pkgs; [ jq ];

exactDeps = true;

tools = {
Expand Down
96 changes: 96 additions & 0 deletions stack.yaml
@@ -0,0 +1,96 @@
resolver: lts-17.11

packages:
- '.'

extra-deps:
- git: https://github.com/input-output-hk/plutus.git
commit: 03a95411238225db1d10288fbd3b405f5f53c78b
subdirs:
- freer-extras
- playground-common
- plutus-core
- plutus-contract
- plutus-ledger
- plutus-ledger-api
- plutus-tx
- plutus-tx-plugin
- plutus-pab
- plutus-use-cases
- prettyprinter-configurable
- quickcheck-dynamic
- git: https://github.com/shmish111/servant-purescript.git
commit: a76104490499aa72d40c2790d10e9383e0dbde63
- git: https://github.com/input-output-hk/cardano-crypto.git
commit: f73079303f663e028288f9f4a9e08bcca39a923e
- git: https://github.com/input-output-hk/cardano-prelude
commit: ee4e7b547a991876e6b05ba542f4e62909f4a571
subdirs:
- cardano-prelude
- cardano-prelude-test
- git: https://github.com/input-output-hk/ouroboros-network
commit: 6cb9052bde39472a0555d19ade8a42da63d3e904
subdirs:
- typed-protocols
- typed-protocols-examples
- ouroboros-network
- ouroboros-network-testing
- ouroboros-network-framework
- io-sim
- io-sim-classes
- network-mux
- Win32-network
- git: https://github.com/input-output-hk/cardano-base
commit: 4251c0bb6e4f443f00231d28f5f70d42876da055
subdirs:
- binary
- binary/test
- slotting
- cardano-crypto-class
- cardano-crypto-praos
- git: https://github.com/input-output-hk/iohk-monitoring-framework
commit: a89c38ed5825ba17ca79fddb85651007753d699d
subdirs:
- iohk-monitoring
- tracer-transformers
- contra-tracer
- plugins/backend-ekg
- git: https://github.com/shmish111/purescript-bridge.git
commit: 6a92d7853ea514be8b70bab5e72077bf5a510596
- Stream-0.4.7.2
- async-timer-0.2.0.0
- base16-bytestring-1.0.1.0
- canonical-json-0.6.0.0
- composition-prelude-3.0.0.2
- dependent-map-0.4.0.0
- dependent-sum-0.6.2.0
- dependent-sum-template-0.1.0.3
- dns-3.0.4
- eventful-memory-0.2.0
- eventful-sql-common-0.2.0
- eventful-sqlite-0.2.0
- lazy-search-0.1.2.1
- monoidal-containers-0.6.0.1
- network-3.1.2.1
- nothunks-0.1.2
- recursion-schemes-5.1.3
- servant-subscriber-0.7.0.0
- servant-websockets-2.0.0
- size-based-0.1.2.0
- statistics-linreg-0.3
- time-out-0.2
- witherable-0.4.1
- constraints-extras-0.3.1.0
- indexed-traversable-instances-0.1
- lazysmallcheck-0.6
- row-types-0.4.0.0
- time-interval-0.1.1

allow-newer: true

ghc-options:
eventful-sql-common: -XDerivingStrategies -XStandaloneDeriving -XUndecidableInstances -XDataKinds -XFlexibleInstances -XMultiParamTypeClasses

nix:
enable: true
packages: [gmp, zlib, cacert]

0 comments on commit e93765d

Please sign in to comment.