6

I am starting the Pioneer program by setting up the development environment. There are several ways to do that, I think 4!

At the end the two that seems to me more appealing are the one using nix or the one using docker.

The former complex but allows you to create an environment that is more up-to-date. The latter is more easy (at least for me) and less time consuming.

Is there any real advantage to use the former? Can we encounter some limitation by following the latter?

4 Answers 4

9

I'm afraid that there are more than 4 ways to setup an environment to follow the Plutus Pioneer Program, considering all the combinations of operating systems, virtualization options and application packaging.

The first thing to decide is if we're going to use some kind of virtualization technology to isolate the environment. In my experience this is highly recommended because:

  • you avoid possible incompatibilities with your host operating system and any already installed software, specially on development systems with many package managers deployed.
  • it keeps your host clean so you can easily start over from a clean state if things go wrong.
  • it allows you to choose a base system that is known to work well independently from your host system.
  • it creates a certain degree of independence from the physical layer (depending on the technology used), to the point where you may decide to setup the exact same environment in the cloud as you don't have the free resources needed in your local computer.

Now, you have two main options to virtualize the environment, a Docker container or a virtual machine.

  • The Docker option requires that, after installing the software, you run an image that someone has previously built (quick and reproducible option), or that you build it yourself using a Dockerfile. In my opinion it may make sense if someone is maintaining images for each week's environment version, with everything already compiled, aiming to save some time, otherwise a virtual machine can offer more flexibility for this use case, persisting changes without much overhead, and allowing to experiment in a more comfortable way.

  • The virtual machine option requires that you install a virtualization software, for example Virtualbox, to deploy a local instance, or that you deploy a cloud instance, for example an AWS EC2, and then that you choose/install your preferred operating system, and finally on top of that install the toolset required to compile the Plutus environment. This can be a bit confusing the first time if you're not used to the tools, i.e. nix, cabal, etc...

Be aware that in previous iterations we needed to weekly recompile the environment to make the code samples work, as a consequence of the Playground being under heavy development.

Fortunately the community made an effort to further document the process for a variety of scenarios, and made it available at the website:

https://docs.plutus-community.com/

https://plutus-community.readthedocs.io/

Please consider contributing to the following repository:

https://github.com/input-output-hk/plutus-community

There's an option that in my opinion takes the best of both worlds for this use case, which is to make use of Vagrant to get a running virtual machine but automating all the initial setup process. You can find instructions on the previous links for a Vagrant+Ubuntu setup.

I wanted to use Vagrant+NixOS for its deterministic nature and its native integration with part of the required toolset, so I developed a Vagrant file and a set of scripts to automate the setup process that can be found here:
https://github.com/jmhoms/plutus-pioneer-nixos-vagrant

I plan to follow this third iteration that is about to start, and I'll try to update the scripts as the course moves forward.

I hope this helps.

Cheers! Josep

7
  • I am not familiar with Vagrant, does it have the problem you described for docker of relying on "someone maintaining images for each week's environment version"?
    – Mateus
    Commented Jan 11, 2022 at 20:01
  • Definetly! For the sake of the learning I will go for an Ubunti virtual box on my windows machine. Then I am gonna use NIX to get the plutus development env and recompile it. The fact that everithing is under heavy development make things much more exciting! Commented Jan 11, 2022 at 20:19
  • 1
    Mateus, think about Vagrant as a wrapper to easily setup for you (just with a couple of cmd lines) an underlying Virtualbox (or others) virtual machine from a pre made image. At the end, you'll have an operating system with the Plutus toolset compiled. Obviously if some weekly exercise requires a different Playground git commit, you'll need to recompile. For this reason I created a git project with a Vagrantfile that takes care of the initial setup, and some scripts that compile the right commit for each week of iteration 2. I plan to do the same for iteration 3. Commented Jan 11, 2022 at 21:04
  • So yes, sort of same issue with Vagrant. In my vagrant-nixos scripts, even if nobody takes care of updating them, you should only need to pass the proper commit id (which is specified inside the weekly project file) to the generic script to get the same result. The existent Docker options probably work in a similar way to update the environment, I guess it makes sense to just change the commit id and recreate the image. So in neither case you're really dependant on someone else updating it, but just saving lot of time IF using an image provided by someone else with the environment precompiled. Commented Jan 11, 2022 at 21:48
  • VirtrualBox is not supported on Apple M1 arm64 architecture. Is it still possible to leverage virtual machines? Commented Jan 12, 2022 at 5:00
3

Typically the team loads all new working code to the Nix container. Additionally, it is more compatible with Haskell/Plutus because it is also written under functional paradigm. I tend to suggest everyone using Nix, once you get familiar everything flows smoothly.

You should check at this set up from the First iteration (for your preferred OS):

https://docs.plutus-community.com/docs/setup/Ubuntu.html

Note that the lectures are outdated but the set up is the same

1

I agree that Nix is the way to go as it will give you the same processes the Plutus educators and devs are working in. Be sure to follow the instructions offered after the webportal went down.

I went with the canonical plutus-apps repo build for the playground. It is the 3rd option off of the document shared after the portal dropped:

**[Plutus Env: Setup Starter Pack].**

BTW, I am using ubuntu 21.04. I have also done the same install on a straight debian build. Sometime over the next couple days I will do the build on my Win10 laptop (dual booting with the Ubuntu).

I hope this helps & Good luck!

1

Indeed. I would prefer using Linux, Ubuntu. Saves you lots of time. You can run it together with a windows installation. Building the shell with Nix is the way to go. I have set up instructions over here .. also Mac and Windows.

https://drive.google.com/file/d/1u6QDsZCPnZQ_QiV8hBihgfFh82iTFs7M/view

1
  • We're a little different from other sites; this isn't a discussion forum but a Q&A site, where we reserve the answer space for answers. Please check out our short tour. Could you please edit this to more directly address the question? Thanks.
    – gRebel
    Commented Jan 14, 2022 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.