-
Notifications
You must be signed in to change notification settings - Fork 0
Add instructions for setup with home-manager and mise #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hlascelles
wants to merge
5
commits into
master
Choose a base branch
from
FB-20728/migrate_some_packages_to_nix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,3 +48,4 @@ build-iPhoneSimulator/ | |
|
|
||
| # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: | ||
| .rvmrc | ||
| /.idea | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] | ||
|
|
@@ -11,4 +12,68 @@ 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. | ||
|
|
||
| 1. Start by installing Nix home-manager. At time of writing, the following command should work. It | ||
| first installs the Nix package manager and daemon, and then installs home-manager. | ||
| ```bash | ||
| sh <(curl -L https://nixos.org/nix/install) --daemon | ||
| ``` | ||
| Then open a new shell and run the following command to install home-manager: | ||
| ```bash | ||
| 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 | ||
| ``` | ||
| 1. We need to get git and zsh on the machine. Add the following to your | ||
| `~/.config/home-manager/home.nix` file: | ||
| ```nix | ||
| { pkgs, ... }: | ||
| { | ||
| home.packages = [ | ||
| # Add these 2 lines in the right place | ||
| pkgs.zsh | ||
| pkgs.git | ||
| ]; | ||
| } | ||
| ``` | ||
| 1. Run the following command to install the git packages specified above: | ||
| ```bash | ||
| home-manager switch | ||
| ``` | ||
| 1. Copy your ssh key into `/home/<username>/.ssh`. Typically, this is your `~/.ssh/id_ed25519` file. | ||
mark-coyle marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| You may need a USB key for this. | ||
| You can also run this to add your passphrase to the `ssh-agent`: | ||
| ```bash | ||
| ssh-add ~/.ssh/id_ed25519 | ||
| ``` | ||
| 1. Run the following command to clone the latest version of the umbrella git repo: | ||
| ```bash | ||
| # You can customise this with your favourite place to put git repos | ||
| SILVERCAT_GIT_CHECKOUTS_DIR=~/code/gh/bambooengineering | ||
| mkdir -p $SILVERCAT_GIT_CHECKOUTS_DIR | ||
| git clone [email protected]:bambooengineering/umbrella.git $SILVERCAT_GIT_CHECKOUTS_DIR/umbrella | ||
| # Then link it to a known location | ||
| ln -s $SILVERCAT_GIT_CHECKOUTS_DIR/umbrella ~/.umbrella | ||
| ``` | ||
| 1. Add this to the top of your `~/.config/home-manager/home.nix` file: | ||
| ```nix | ||
| imports = [ | ||
| /home/<username>/.umbrella/bambrew/assets/nix/silvercat.nix | ||
| ]; | ||
| ``` | ||
| 1. Run the following command to install the silvercat `home-manager` packages and system utilities. | ||
| Note, this is idempotent and should be quick once completed a 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| if [ -z "$USER" ]; then | ||
| echo "Aborting! No USER environment variable set" | ||
| exit 3; | ||
| fi | ||
|
|
||
| if [ "$(id -u)" = 0 ]; then | ||
| echo "Aborting! Must not be run as root" | ||
| exit 4 | ||
| fi | ||
|
|
||
| if [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then | ||
mark-coyle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||
| # TODO: Need new shell here? | ||
| 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 | ||
| # TODO: Need new shell here? | ||
|
||
| fi | ||
|
|
||
| if [ ! -d "~/.umbrella" ]; then | ||
| "${SILVERCAT_GIT_CHECKOUTS_DIR:=$HOME/code/gh/bambooengineering}" | ||
| echo "Cloning umbrella into $SILVERCAT_GIT_CHECKOUTS_DIR... (change SILVERCAT_GIT_CHECKOUTS_DIR ENV to put it somewhere else)" | ||
| 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 | ||
|
|
||
| # TODO: allow setting umbrella checkout branch if doing work on it etc.. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.