Skip to content

Commit

Permalink
Update Nix Build
Browse files Browse the repository at this point in the history
  • Loading branch information
Totes5706 committed Mar 30, 2022
1 parent bfa8521 commit 8050eb8
Show file tree
Hide file tree
Showing 30 changed files with 972 additions and 16,038 deletions.
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Contributing

## How to update dependencies

1. Go to https://github.com/input-output-hk/plutus-apps/tags and take note of the latest `plutus-starter-devcontainer` tag and its commit hash.
2. Update the tag and/or hash in the following files:
- `.devcontainer/devcontainer.json`
- `nix/sources.json`
- `nix/pkgs/haskell/haskell.nix`
- `cabal.project`
3. Copy over most of https://github.com/input-output-hk/plutus-apps/blob/main/cabal.project into `cabal.project`
4. Copy over the `sha256map` values from https://github.com/input-output-hk/plutus-apps/blob/main/nix/pkgs/haskell/haskell.nix into `nix/pkgs/haskell/haskell.nix` (but leave the first line that you just changed in step 2). To get the right hash value for `plutus-apps`, change one digit, then run `nix-shell`. You will get an error that shows the correct hash.
5. It’s likely that the code for the guessing game needs to be changed; luckily, you can copy the source from https://github.com/input-output-hk/plutus-apps/blob/main/plutus-playground-server/usecases/Game.hs roughly, and it should work.
6. Test the different parts:
- VSCode
* You need to make sure to rebuild the image
* Then, once in VSCode, do `cabal build` and `cabal test`, and then make sure HLS works
- nix
* `nix-shell`
* `cabal build`/`cabal test`
52 changes: 28 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ This script creates the validation keys and addresses, and passes the parameters

In order to run the bash script, two dependencies are needed:

- nix needs to be installed in order to use the proper git commit for nix-shell. This can be run without nix, however it is highly recommended and the easier path to setup.
- nix needs to be installed in order run nix-shell in the main git repo. Running nix-shell in this repo now includes cardano-node and cardano-cli, so they are not needed for installation.

- the cardano node must be fully synced

If you are in the Plutus Pioneer Program, these should already be installed. If not, follow along the next two subsections for the how to installation.
Expand Down Expand Up @@ -75,17 +76,10 @@ This part should now be completed.

### Syncing the Cardano Node

By default, nix-shell includes the cardano-node and the cardano-cli. Therefore, we need to run nix-shell then sync the node.
By default, nix-shell includes the cardano-node and the cardano-cli. Therefore, we need to run nix-shell then sync the node. If you currently do not have a node running, follow along to get the helper scripts to sync the cardano node:


First, let’s clone plutus-apps repo from IOHK if you do not already have it:

- Directory: ```totinj@penguin:~$```
```
git clone https://github.com/input-output-hk/plutus-apps.git
```

Next, let’s clone this cnode repo that already contains the sync scripts and config files:
First, let’s clone this cnode repo that already contains the sync scripts and config files:

- Directory: ```totinj@penguin:~$```
```
Expand All @@ -99,17 +93,24 @@ chmod +x start-mainnet-node.sh start-testnet-node.sh
sudo ./update-config.sh
```

Head to the plutus-apps directory, and you can now run nix-shell. Run nix-shell:
Next, let's clone this repo:

- Directory: ```totinj@penguin:~/plutus-apps$```
- Directory: ```totinj@penguin:~$```
```
git clone https://github.com/Totes5706/cardano-alonzo-nft-creator.git
```

Head to the cardano-alonzo-nft-creator main directory, and you can now run nix-shell. Run nix-shell:

- Directory: ```totinj@penguin:~/cardano-alonzo-nft-creator$```
```
nix-shell
```

If this is run for the first time, it will take some time to build (30min + for a non-workstation computer).


While in nix-shell, head to the node directory inside this repo that we just cloned:
While in nix-shell, head to the node directory inside the cnode repo that we just cloned earlier:

- Directory: ```[nix-shell:~/cnode]$```

Expand Down Expand Up @@ -141,13 +142,7 @@ First, make sure your cardano-node is running and fully synced.
Also, make note of the location node.socket file for your node; you will need the directory location of it when you start the script.
Alternatively, in the [env.sh](https://github.com/Totes5706/cardano-alonzo-nft-creator/blob/main/env.sh) you can instead include the path there and then run ```. env.sh``` to declare it as an environment variable.

Second, ensure you have plutus-apps repo from IOHK cloned and also this repo.
If you do not, clone plutus-apps repo from IOHK by the following:

- Directory: ```totinj@penguin:~$```
```
git clone https://github.com/input-output-hk/plutus-apps.git
```
Second, make sure you have already cloned this repo.

Clone this repo by:

Expand All @@ -156,14 +151,14 @@ Clone this repo by:
git clone https://github.com/Totes5706/cardano-alonzo-nft-creator.git
```

Head to the plutus-apps directory. You can now run nix-shell in this directory. Run nix-shell:
Head to the cardano-alonzo-nft-creator main directory, and you can now run nix-shell. Run nix-shell:

- Directory: ```totinj@penguin:~/plutus-apps$```
```
- Directory: ```totinj@penguin:~/cardano-alonzo-nft-creator$```
```
nix-shell
```

Now, while in nix-shell, head over to this repo to build the project:
Now, while in nix-shell, update cabal and build the project:

- Directory: ```[nix-shell:~/cardano-alonzo-nft-creator]$```
```
Expand Down Expand Up @@ -192,6 +187,14 @@ Building executable 'token-policy' for cardano-alonzo-nft-creator-0.1.0.0..
Preprocessing executable 'token-name' for cardano-alonzo-nft-creator-0.1.0.0..
Building executable 'token-name' for cardano-alonzo-nft-creator-0.1.0.0..
```

Make sure we have executable permissions for the bash script:

- Directory: ```[nix-shell:~/cardano-alonzo-nft-creator]$```
```
chmod +x make-nft.bash
```

We are now ready to start using the NFT maker! To start the script, in this directory run:


Expand All @@ -200,6 +203,7 @@ We are now ready to start using the NFT maker! To start the script, in this dire
./make-nft.bash
```


## Sample Output


Expand Down
Loading

0 comments on commit 8050eb8

Please sign in to comment.