Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ build-iPhoneSimulator/

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
/.idea
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# bambrew

Bambrew - Bamboo Engineering's development environment setup tooling

# First time setup
# Mac First time setup

1. Ask an existing `bambooengineering/umbrella` administrator to grant you repo access
1. Setup a GitHub [personal access token][1]
Expand All @@ -11,4 +12,31 @@ Bambrew - Bamboo Engineering's development environment setup tooling
sh -c "$(curl -fsSL https://github.com/bambooengineering/bambrew/raw/master/run_bamstrap)"
```

# Linux first time setup

Linux setup is largely done with Nix home-manager (not full NixOS). The steps below amount to
setting up home-manager, git and getting a checkout of the main repo. After that, it is all a script
in that repo.

The script in this repo will achieve that. The steps are:

1. Run this to get `home-manager` and the main repo ready:
```bash
SILVERCAT_GIT_CHECKOUTS_DIR= ~/code/gh/bambooengineering sudo sh -c "$(curl -fsSL https://github.com/bambooengineering/bambrew/raw/master/run_bamstrap_linux)"
```
2. Add this to the top of your `~/.config/home-manager/home.nix` file:
```nix
imports = [
/home/<username>/.umbrella/bambrew/assets/nix/silvercat.nix
];
```
3. Run the following command to install the silvercat `home-manager` packages and system utilities.
Note, this is idempotent and should be quick once completed the first time. You should run it
regularly.
```bash
~/.umbrella/bambrew/scripts/setup.sh
```

That's it. Read the bambrew docs on starting up the development environment.

[1]: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line
63 changes: 63 additions & 0 deletions run_bamstrap_linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

set -e

if [ "$(id -u)" = 0 ]; then
echo "Aborting! Must not be run as root"
exit 4
fi

if [ -z "$USER" ]; then
echo "Aborting! No USER environment variable set"
exit 3;
fi

if [ -z "$SILVERCAT_GIT_CHECKOUTS_DIR" ]; then
echo "Aborting! No SILVERCAT_GIT_CHECKOUTS_DIR environment variable set"
echo "Set it to any directory where you want to clone all Silvercat repos."
echo "For example: export SILVERCAT_GIT_CHECKOUTS_DIR=~/code/gh/bambooengineering"
exit 3;
fi

if [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then
if [ ! -f "$HOME/.ssh/id_ed25519.pub" ]; then
echo "Ensure you have your GitHub SSH key at ~/.ssh/id_rsa.pub or ~/.ssh/id_ed25519.pub"
exit 1
fi
fi

if [ ! -d "nix" ]; then
echo "Installing nix..."
sh <(curl -L https://nixos.org/nix/install) --daemon
echo "Done installing nix! Open a new shell then run this script again."
exit 1
fi

if [ -x "$(command -v home-manager)" ]; then
echo "Installing home-manager..."
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
home-manager switch

echo "Now you must set up your machine to clone GitHub repos. You can do this one of two ways:

1. Copy your ssh key into /home/<username>/.ssh. Typically, this is your ~/.ssh/id_ed25519 file.
You may need a USB key for this.
You can also run this to add your passphrase to the ssh-agent:
ssh-add ~/.ssh/id_ed25519
2. Use gh as installed above and run: gh auth login
This will then prompt you to authenticate with github, which you can do via the browser."

echo "After you have done that, run this script again."
exit 1
fi

if [ ! -d "~/.umbrella" ]; then
echo "Cloning umbrella into $SILVERCAT_GIT_CHECKOUTS_DIR..."
mkdir -p "$SILVERCAT_GIT_CHECKOUTS_DIR"
nix shell -p git -c "git clone [email protected]:bambooengineering/umbrella.git $SILVERCAT_GIT_CHECKOUTS_DIR/umbrella"
ln -s "$SILVERCAT_GIT_CHECKOUTS_DIR/umbrella" ~/.umbrella
fi

echo "Completed checkout. Now add the silvercat.nix to your home-manager config and "