docker volume create plutus-nix-store
docker build -t plutus-apps-container .devcontainer
// On devcontainer startup run: /home/builder/nix-shell.sh
On devcontainer startup run: cd /home/user/plutus-apps && nix-shell --extra-experimental-features flakes
You will enter nix shell
Then run cd /workspaces/plutus-buoy
Compiling library:
cabal install --lib
cd /home/user/plutus-apps mkdir /workspaces/plutus-buoy/keys cardano-cli address key-gen --verification-key-file /workspaces/plutus-buoy/keys/payment.vkey --signing-key-file /workspaces/plutus-buoy/keys/payment.skey
This project gives a simple starter project for using the Plutus Platform.
Use the provided VSCode devcontainer to get an environment with the correct tools set up.
- Install Docker
- Install VSCode
- Install the Remote Development extension pack
- You do not need to install the Haskell extension
- Ensure you have a
~/.cabal/packages
folder. You can create this viamkdir -p ~/.cabal/packages
; it's used to cache cabal packages. - Clone this repository and open it in VSCode
- It will ask if you want to open it in the container, say yes.
- The first time it will take a few minutes to download the devcontainer image from dockerhub,
cabal build
from the terminal should work (unless you didn't have a~/.cabal
folder, in which case you'll need to runcabal update
first.)- Opening a Haskell file should give you IDE features (it takes a little while to set up the first time)
Note: This uses the plutus-starter-devcontainer image on dockerhub, if you wish to build the image yourself, you can do so as follows:
- Clone https://github.com/input-output-hk/plutus,
- Set up your machine to build things with Nix, following the Plutus README (make sure to set up the binary cache!),
- Build and load the docker container:
docker load < $(nix-build default.nix -A devcontainer)
, - Adjust the
.devcontainer/devcontainer.json
file to point to your local image.
Alternatively, use the Cabal+Nix build if you want to develop with incremental builds, but also have it automatically download all dependencies.
Set up your machine to build things with Nix
, following the Plutus README (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:
$ nix-shell
Otherwise, you can use direnv which allows you to use your preferred shell. Once installed, just run:
$ echo "use nix" > .envrc # Or manually add "use nix" in .envrc if you already have one
$ direnv allow
and you'll have a working development environment for now and the future whenever you enter this directory.
The build should not take too long if you correctly set up the binary cache. If it starts building GHC, stop and setup the binary cache.
Afterwards, the command cabal build
from the terminal should work (if cabal
couldn't resolve the dependencies, run cabal update
and then cabal build
).
Also included in the environment is a working Haskell Language Server you can integrate with your editor. See here for instructions.