Two methods for developing Plutus applications are provided here:
- Developing with Nix using a
nix-shell
- Developing with Docker and VSCode dev containers
The nix-shell
environment has all the necessary tools configured for building
Plutus applications. If you already have Nix installed, or a Haskell editor you
prefer, you may enjoy this method.
The Docker/VSCode environment builds a full-featured Haskell/Plutus development environment based on Docker and VSCode. It requires only Docker and VSCode to be installed, and uses Haskell IDE Engine inside the container to provide a Haskell IDE. Those less familiar with Nix may prefer this method.
This folder contains a shell.nix
file that builds a configured development
environment for Plutus projects. With Nix installed,
you can follow these steps to enter the environment for this example project:
$ git clone https://github.com/input-output-hk/plutus.git
$ cp -r ./plutus/example <path to your project>
$ cd <path to your project>
$ nix-shell
The nix-shell
command will examine the shell.nix
file of this folder, and create
an isolated environment where the packages and tools defined in that file are available.
Once the nix-shell
environment has loaded, you can edit your project files
with any Haskell editor you prefer, then in the nix-shell
you can build your project with
cabal v2-build
or compile and run your project's executable with cabal v2-run
.
The University of Wyoming's IOHK Blockchain Research and Development Lab maintains Docker images for development on the Plutus Platform. Those images can be used as VSCode dev containers to make a full-featured Plutus development environment.
The images contain GHC with a configured Haskell IDE Engine installation that works out-of-the-box for Plutus development.
- Install Docker
- Install Visual Studio Code
- Install the Remote Development Extension Pack for Visual Studio Code
After you've completed the prerequisites, follow the steps below:
$ git clone https://github.com/input-output-hk/plutus.git
$ cp -r ./plutus/example <path to your project>
$ cd <path to your project>
If you've installed VSCode correctly and put it's CLI on your PATH
,
this can be done by running:
$ code <path to your project>
Or you can just open your project from inside VSCode.
With the Remote Development Extension Pack installed in VSCode, you will see a green button at the bottom left corner of the window:
Click that button, and select the "Remote-Containers: Reopen in Container" option:
This will reload your VSCode window, and place you inside a workspace folder (/plutus
) in
the container that is bind mounted
to your project's folder.
Once inside the dev container, you can build your project with cabal v2-build
or compile and run your project's executable with cabal v2-run
. You can
also stop/restart/remove the container whenever.