Set up your environment
This guide will help you set up a working development environment on your work machine.
Machine
Below you will find all the required steps in order to configure the most basic machine setup.
-
Install Git, Direnv, Sops, and VSCode:
-
Add your SSH key to your GitLab account.
-
Configure Git to sign commits using SSH.
-
Write an email to help@fluidattacks.com requesting developer access to the Universe Repository.
Environment
This section will guide you through setting up a terminal with AWS credentials and a code editor in an automated way every time you enter your local checkout of the Universe repository.
After this section you will have:
- A terminal with AWS credentials for the specific product you are developing.
- An editor with:
- The source code of the Universe repository.
- Recommended development extensions.
- Automatic code formatters on save.
- Auto completion and go to definition.
- OS libraries required.
Terminal
We’ll configure the terminal first. Once the terminal is configured, all of the applications you open from it will inherit the development environment and credentials.
At this point you should have Nix and Makes already installed in your system, so we won’t go into those details.
For maximum compatibility,
we suggest you use GNU Bash
as the command interpreter of your terminal.
Please follow these steps:
-
Make sure you have the following tools installed in your system:
- Nix
- Makes
- Git
- Direnv
- VSCode
- If you are missing any of the previous tools, refer back to the machine configuration
-
Clone the Universe repository using SSH:
-
cd
to the root of the repository and configure your Git username and email: -
Add the following file in
universe/.envrc.config
: -
Configure
direnv
by adding the following lines to your~/.bashrc
file: -
cd
to universe and run the following commands:This will start the login process on your terminal.
Editor
We highly recommend you use Visual Studio Code because most of the team uses it, and it works very well for our purpose.
-
You can open the universe directory, either using the
File > Open Folder
option in the menu or from a terminal, still within the universe repository withcode .
. -
Go to the extensions tab
(Ctrl+Shift+X)
, type@recommended
, and install the recommended extensions for the workspace.
Your first commit
You have almost finished the onboarding.
Your next goal is making your first commit reach production.
-
Read the Contributing section carefully.
-
Create a new issue following the onboarding template and assign it to you.
-
Create your local branch.
-
Add your name, username and email to the .mailmap file.
-
Make sure your commit message follows the expected syntax.
-
Check if the commit message is valid using Makes:
-
Push your commit to the repository.
-
Once the Merge Request is approved and merged, and every other item in the issue is done, you can go ahead and close the issue.
Troubleshooting
Here you will find typical errors and how to solve them.
Nix breaks after updating my mac
Sometimes, after updating your Mac, Nix does not work properly.
This usually happens because
some macOS updates overwrite ~/.zshrc
.
In order to fix this:
- Add the following lines to your
~/.zshrc
file: - Restart your machine