Setup of a development machine

This is a small wrap ap about setting up a dev environment which I am using at the moment.

It works for me, your mileage may vary.

The guide covers both Linux (WSL) and Osx,

Brew

Installation

Note that the final 2 steps may have a different path if you are running it on the windows instead of osx

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Apps

Cli

brew install kind wget gnupg wget awscli terraform helm jq stern kubectx telnet pre-commit golangci-lint velero checkov terraform-docs infracost tfsec tflint terragrunt terrascan kube-ps1
helm plugin install https://github.com/hypnoglow/helm-s3.git

Gui (OSX)

brew tap homebrew/cask
brew install pinentry-mac 
brew install --cask hiddenbar
brew install --cask rancher
brew install --cask visual-studio-code
brew install --cask termius
brew install --cask cyberduck

Zsh

Install Oh My Zash

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Spaceship theme

git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

Plugins

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Config

Change following values in .zshrc (you can simply place them right before the source $ZSH/oh-my-zsh.sh line)

####
plugins=(
  git
  zsh-autosuggestions
  aws
  docker
  wd
  zsh-syntax-highlighting
)

ZSH_THEME="spaceship"
COMPLETION_WAITING_DOTS="true"
ZSH_THEME="spaceship"

export HOMEBREW_NO_AUTO_UPDATE=1

alias k=kubectl
export PATH="~/bin:$PATH"
#####

Osx App store

Install following apps

  • Amphetamine
  • Microsoft TODO

aws config

Disable pagination on aws cli commands

mkdir -p  ~/.aws/
cat > ~/.aws/config <<EOF
[default]
region = eu-west-2
cli_pager=
EOF

Sublime Text

OSX: fix keys behaviour (home, end)

Preferences > Key Bindings - User

{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } }

Setup gpg key to sign the git commits

Export the key from keybase and import it to gpg keychain

  • Find the id of the key you want to export
  • From terminal run keybase pgp export -q 772FB27A86DAFCE7 --secret | gpg --allow-secret-key-import --import
  • When prompted with the password (and this is really dumb UI), first enter your keybase password, next, CHOOSE a password which will be used to protect the key
  • Verify that the key has been imported with gpg --list-secret-keys

Trust the new key

gpg --edit-key 772FB27A86DAFCE7
gpg>trust
Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say
  2 = I do NOT trust
  3 = I trust marginally
  4 = I trust fully
  5 = I trust ultimately
  m = back to the main menu

Your decision? 5
Do you really want to set this key to ultimate trust? (y/N)

Setup git

Identity

git config --global user.email [email protected]
git config --global user.name "xxx xxx"

Setup Git Gpg signing

git config --global user.signingkey 772FB27A86DAFCE7
git config --global commit.gpgsign true
git config --global gpg.program /usr/local/bin/gpg

Test gpg signing

In an empty folder (/tmp) run

mkdir test
cd test
git init 
touch test.txt
git add test.txt
git commit -m "test signed commits"

It should not give any issues, double check with git log --show-signature

Ssh client config

Create/edit following file: ~/.ssh/config and place following content in it:

cat > ~/.aws/config <<EOF
Host *
     User root
     Compression yes
     LogLevel INFO
     ForwardAgent yes
     ForwardX11 yes
     StrictHostKeyChecking accept-new
EOF                          

Jetbrains mono font

Download font from https://www.jetbrains.com/lp/mono/ and add it through the font book

OSX: Iterm settings

Profiles

Text

Use builtin powerline glyphs Font: Jetbrains Mono, 13

Vim setting

wget https://raw.githubusercontent.com/amix/vimrc/master/vimrcs/basic.vim
mv basic.vim .vimrc

Osx settings

Keyboard

Key Repeat to Fast and Delay Until Repeat to Short

Use F1,F2 as standard function keys

in Settings -> Keyboard -> modifier keys choose karabiner keyboard and assign

  • Command to Control
  • Control to Command

Copyright

Comments