From 0742afcfe385fa49124cfbf2d4f45db417be1dcb Mon Sep 17 00:00:00 2001 From: Gleb Date: Thu, 8 Aug 2024 20:13:14 -0700 Subject: [PATCH] Update contributing guide and clean flake --- .gitignore | 1 + CONTRIBUTING.md | 25 +++++++++++++++++++++++++ flake.nix | 6 ++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b59c637209..7723bb84b1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ snapshot.json test_snapshots .vscode/settings.json .idea +local.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index db10e3456b..94fe0a87d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,31 @@ changes quickly. * Clearly describe the issue including steps to reproduce if it is a bug. * Fork the repository on GitHub. +## Setting up development environment + +There are 2 ways to being developing stellar-cli: + +### Installing all required dependencies + +You may want to install all required dependencies locally. This includes installing `rustup`, `make`, `libudev`, `jq` from your package manager. After all dependencies are installed, you can start with running `make build` to build `stellar-cli` on your machine! + +### Using `nix` + +If you don't want to install necessary dependencies from above, you can run development shell using [nix](https://nixos.org/guides/how-nix-works/) (make sure to [install](https://nixos.org/download/) version above 2.20). After installing `nix`, simply run `nix develop` that will start new `bash` session in your current terminal. If you want to use different shell (e.g. `zsh`) you can run `nix develop -c zsh` + +This session will have: +1. All required dependencies installed +2. `stellar` alias (overwriting your existing `stellar` installed via cargo, if any) +3. Configured auto-complete for the working git branch + +You can add extra configuration in your `local.sh` file (for example, if you want to export some extra variables for your devshell you can put following in your `local.sh`: +```shell +#!/usr/bin/env bash +export STELLAR_NETWORK=testnet +``` +Note that all of dependencies and configurations mentioned above is available only in your local development shell, not outside of it. + + ### Minor Changes #### Documentation diff --git a/flake.nix b/flake.nix index 2fd1f4d3da..d832c50bfb 100644 --- a/flake.nix +++ b/flake.nix @@ -32,10 +32,8 @@ '' echo "Using `nix --version`" alias stellar="cargo run --bin stellar --" - SOROBAN_SECRET_KEY=SBPXU3OP65M2DQPRM4YFZ5NME66NWWH5DHN44IBDYAN4TFKKY7CS4OHY stellar keys add dev_key - export STELLAR_NETWORK=testnet - export STELLAR_ACCOUNT=dev_key - shell=$0 + [ -f ./local.sh ] && source ./local.sh + shell=$0 shell=`basename $SHELL` source <(stellar completion --shell $shell) '';