Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix plutus-apps repo location #72

Merged
merged 7 commits into from
Jan 21, 2022
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
16 changes: 8 additions & 8 deletions book/docs/setup/CabalBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ this up.**

Let's say that I have done a git clone on 2 repositories.

1. [Plutus](https://github.com/input-output-hk/plutus)
1. [Plutus-Apps](https://github.com/input-output-hk/plutus-apps)
2. [Plutus-Pioneer-Program](https://github.com/input-output-hk/plutus-pioneer-program)

Both of them, I have decided to put in ```/opt/``` for the example.
Expand All @@ -21,26 +21,26 @@ The Plutus Pioneer Program source is made to compile and run against Plutus for
a specific commit hash which is listed in each week's `cabal.project` file.

For example, in `plutus-pioneer-program/code/week02/cabal.project` there's a
block like this specifying the `plutus` repo.
block like this specifying the `plutus-apps` repo.

```bash
source-repository-package
type: git
location: https://github.com/input-output-hk/plutus.git
location: https://github.com/input-output-hk/plutus-apps.git
subdir:
freer-extras
...
prettyprinter-configurable
tag: 3746610e53654a1167aeb4c6294c6096d16b0502
tag: 41149926c108c71831cfe8d244c83b0ee4bf5c8a

```

You'll want to cd to the plutus directory and checkout the commit where the
You'll want to cd to the plutus-apps directory and checkout the commit where the
`tag:` line is pointing before building and starting the playground. Stop the
client and server and then

```bash
git checkout 3746610e53654a1167aeb4c6294c6096d16b0502
nix build -f default.nix plutus.haskell.packages.plutus-core
git checkout 41149926c108c71831cfe8d244c83b0ee4bf5c8a
```

And then start the server and client back up again. For more details and
Expand Down Expand Up @@ -70,7 +70,7 @@ First, we bring up a nix-shell which sets up the environment and has working
versions of tools (like cabal)

```ssh
cd /opt/plutus
cd /opt/plutus-apps
nix-shell
```

Expand Down
79 changes: 37 additions & 42 deletions book/docs/setup/MacOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,72 +42,41 @@ _**Note 2:**_ if the file /etc/nix/nix.conf doesn't exist: create it. (`[$] mkdi

7 - Now to install, clone the git repo first

[$] git clone https://github.com/input-output-hk/plutus.git
[$] git clone https://github.com/input-output-hk/plutus-apps.git


8 - All the following builds should be executed while in the plutus directory

[$] cd plutus
[$] cd plutus-apps


9 - Build the Plutus Core (This may take some time :) be patient)

[$] nix build -f default.nix plutus.haskell.packages.plutus-core.components.library


_**Note:**_

On MacOS BigSur some users have reported that the building failed with an error like:

error: while setting up the build environment: getting attributes of path '/usr/lib/libSystem.B.dylib': No such file or directory


There are two solutions that are reported to solve this problem:
- Change the nix build to an unstable (read: newer) build of nixpkgs.
```bash
[$] sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable unstable
```

- Disabling the`sandbox` and `extra-sandbox-paths` properties in the `/etc/nix/nix.conf` and `~/.config/nix/nix.conf` files.

_**Note 2:**_

If anyone gets stuck because of this error:

"error: refusing to create Nix store volume ... boot volume is FileVault encrypted"

You should heck out these links (Thank you u/call_me_coldass):
[https://github.com/digitallyinduced/ihp/issues/93#issuecomment-766332648](https://github.com/digitallyinduced/ihp/issues/93#issuecomment-766332648)
[https://www.philipp.haussleiter.de/2020/04/fixing-nix-setup-on-macos-catalina/](https://www.philipp.haussleiter.de/2020/04/fixing-nix-setup-on-macos-catalina/)


10 - Build the Plutus Playground Client / Server
9 - Build the Plutus Playground Client / Server

[$] nix-build -A plutus-playground.client
[$] nix-build -A plutus-playground.server


11 - Build other plutus dependencies
10 - Build other plutus dependencies

[$] nix-build -A plutus-playground.generate-purescript
[$] nix-build -A plutus-playground.start-backend
[$] nix-build -A plutus-pab


12 - Go into nix-shell
11 - Go into nix-shell

[$] nix-shell


13 - inside of the nix-shell
12 - inside of the nix-shell

[$] cd plutus-pab
[$] plutus-pab-generate-purs
[$] cd ../plutus-playground-server
[$] plutus-playground-generate-purs


14 - start the playground server
13 - start the playground server

[$] plutus-playground-server

Expand All @@ -118,14 +87,14 @@ You should heck out these links (Thank you u/call_me_coldass):



15 - Now in a new terminal window:
14 - Now in a new terminal window:

[$] cd plutus
[$] cd plutus-apps
[$] nix-shell
[$] cd plutus-playground-client


16 - Here we compile / build the frontend of the playground
15 - Here we compile / build the frontend of the playground

[$] npm run start

Expand All @@ -144,6 +113,32 @@ Cloned from [Reddit](https://www.reddit.com/r/cardano/comments/mmzut6/macos_plut

Go give u/RikAlexander karma!

_**Note:**_

On MacOS BigSur some users have reported that the building failed with an error like:

error: while setting up the build environment: getting attributes of path '/usr/lib/libSystem.B.dylib': No such file or directory


There are two solutions that are reported to solve this problem:
- Change the nix build to an unstable (read: newer) build of nixpkgs.
```bash
[$] sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable unstable
```

- Disabling the`sandbox` and `extra-sandbox-paths` properties in the `/etc/nix/nix.conf` and `~/.config/nix/nix.conf` files.

_**Note 2:**_

If anyone gets stuck because of this error:

"error: refusing to create Nix store volume ... boot volume is FileVault encrypted"

You should check out these links (Thank you u/call_me_coldass):
[https://github.com/digitallyinduced/ihp/issues/93#issuecomment-766332648](https://github.com/digitallyinduced/ihp/issues/93#issuecomment-766332648)
[https://www.philipp.haussleiter.de/2020/04/fixing-nix-setup-on-macos-catalina/](https://www.philipp.haussleiter.de/2020/04/fixing-nix-setup-on-macos-catalina/)




## Troubleshooting
Expand Down Expand Up @@ -182,7 +177,7 @@ Segmentation fault: 11
```

Copy link

@nrkramer nrkramer Jan 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running either the server or client will require GC_DONT_GC=1 be prepended to the command.

This is because the garbage collector incorrectly marks some of the dependencies as unneeded. See https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md. These instructions work well for both M1 and Intel-based Macs.

Sadly it's not yet possible to run plutus-playground without support from Rosetta 2. Hopefully, once IOHK has all the ARM binary caches ready, it will be possible.

Solution:
- Upgrade the `plutus` repo to a later release (maybe master branch).
- Upgrade the `plutus-apps` repo to a later release (maybe master branch).
Since `haskell-language-server` has version 0.9.0.0 (as you can see in the first line after execution) and this version is not ready for macOS Big Sur.
_**Note**_ This error probably occurs due to the linker changes introduced in macOS Big Sur, [see](https://github.com/input-output-hk/haskell.nix/issues/982)

Expand Down
25 changes: 6 additions & 19 deletions book/docs/setup/Ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ More detailed info can be found in the

### single-user

Single-user Nix installation has advantages.
Single-user Nix installation has advantages.
- No daemon and socket are created
- A group of 32 nix users doesn't get created on the system
- Nothing is written into `/etc`
Expand Down Expand Up @@ -134,32 +134,19 @@ nix-env (Nix) 2.3.14

## Build the Plutus Playground server and client and start it

We now need to get the plutus repo which contains the libraries for
We now need to get the plutus-apps repo which contains the libraries for
working on Plutus and the Plutus Playground server.

```ssh
git clone https://github.com/input-output-hk/plutus
cd plutus
git clone https://github.com/input-output-hk/plutus-apps
cd plutus-apps
```

**Note** If you will be working on the Plutus Pioneer Project, it will be
necessary at this point to `git checkout ...` a specific commit to match the
class materials. That commit hash is listed in the exercises week## directory
in the `cabal.project` file. For more info on this, see [Working on contracts with and without cabal build](https://docs.plutus-community.com/docs/setup/CabalBuild.html)

Now we build the plutus repo

```ssh
nix build -f default.nix plutus.haskell.packages.plutus-core
```
If you have Nix version 2.4 the nix build command needs to be formatted differently:
```ssh
nix --experimental-features nix-command build --file default.nix plutus.haskell.packages.plutus-core
```
This will take a while the first time. It will only be necessary to do it again
if/when you `git pull` changes down from github or switch to a different
branch/commit. These probably won't happen often.

Now we will run the Plutus Playground servers. We start these in a `nix-shell`
which sets up the environment and has working versions of tools.

Expand All @@ -174,7 +161,7 @@ Open two terminal windows
In terminal window 1

```ssh
cd plutus
cd plutus-apps
nix-shell
cd plutus-playground-server
plutus-playground-server
Expand All @@ -185,7 +172,7 @@ If it's successful, you should see `Interpreter ready`
In terminal window 2

```ssh
cd plutus
cd plutus-apps
nix-shell
cd plutus-playground-client
npm run start
Expand Down
8 changes: 4 additions & 4 deletions book/docs/setup/WindowsWSL.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Should work on Windows 10 with WSL 2

3 - In your wsl shell, in your linux ~/src (for example) do:

[$] git clone https://github.com/input-output-hk/plutus
[$] git clone https://github.com/input-output-hk/plutus-apps

4 - Read the README file it will tell you how to get Nix

Expand All @@ -34,9 +34,9 @@ Should work on Windows 10 with WSL 2

7 - Relaunch the shell

8 - CD into Plutus. Build Plutus with the Nix command line in the README file.
8 - CD into Plutus-apps. Build Plutus with the Nix command line in the README file.

[$] nix build -f default.nix plutus.haskell.packages.plutus-core.components.library
[$] nix build -f plutus-apps.haskell.packages.plutus-pab.components.library

9 - Install Docker for Windows (relaunch your shell)

Expand Down Expand Up @@ -113,7 +113,7 @@ https://code.visualstudio.com/docs/remote/wsl#_advanced-opening-a-wsl-2-folder-i

15 - Now in a new terminal window:

[$] cd plutus
[$] cd plutus-apps
[$] nix-shell
[$] cd plutus-playground-client
[$] plutus-playground-server
Expand Down