General Computer Setup
This document describes best-practices how to setup your work-machine or laptop for a nice software-development workflow.
Creating a development setup can be tedious. Especially when you install and configure programs and do not want to redo things again in the future. Therefore it makes sense to versionize configuration files and use a dotfile management setup.
For advanced users, using NixOS can simplify these steps, as NixOS uses a functional language to describe the whole system.
Package Manager
MacOS
On macOS brew
is a powerful and easy to use package manager.
- Install
brew
.
Linux
Use the Linux distribution package manager. You can also install brew
on Linux
which does not hinder at all. See here.
Windows
Install chocolately.
Git & Git LFS Setup
The most important tool is Git. Git LFS manages large-files (e.g. binary blobs, pictures etc.) and is needed to store data files in git repositories. It comes with most git installations.
To install it do the following:
- MacOS:
brew install git git-lfs
- Windows: Installer. Use all defaults.
- Linux: Use the package manager of your OS. Make sure
git-lfs
is installed.
It is recommended to use a dotfile manager setup where Git LFS is configured already. If you do not, you need to run the following in a terminal:
git lfs install
which sets up Git LFS into global ~/.gitconfig
.
GNU Privacy Guard
Using GPG (GNU Privacy Guard) with Git allows you to sign commits and tags, verifying your identity as the author.
-
Install it with:
- MacOS:
brew install gpg
. - Windows:
choco install gnugpg
. - Linux: Use the package manager of your OS.
- MacOS:
-
Generate a GPG key with
gpg --default-new-key-algo ed25519 --gen-key
-
Get the key id
<your-key-id>
of your key withgpg --list-secret-keys --keyid-format=long
-
Add it to the Git config with
git config --global user.signingkey <your-key-id>
-
Copy the public key and add it to your Github/Gitlab account.
Githooks
Git hooks are callbacks in Git which happen on certain events. The pre-commit
hooks is for example is useful to assert certain things before git commit
(checking everything is formatted etc.). Because Git hooks are a bit hard to
manage, different Git hooks managers exist which facilitate the use of Git hooks
(e.g. Githooks,
pre-commit(not recommended)) in a Git repository.
Its recommended to install Githooks for
enabled projects (e.g. containing a
.githooks
.
folder). If Githooks is installed, it will automatically manage Git hooks.
Essential Packages
Some systems come without some proper utilities. MacOS
, by default, has its
own out-dated zsh
and bash
and not all GNU utilities which are essential to
have installed to not be prone to strange incompatibility issues.
MacOS
Install the following tools.
brew install \
binutils \
coreutils \
findutils \
git git-lfs \
bash \
grep \
gnu-sed gnu-tar gnu-time
Linux
Depending on the distribution its still good to have binutils
, coreutils
and
findutils
installed.
Windows
If you use git-bash.exe
all GNU utilities are available.
Essential Fonts
For programming and terminal navigation, it is recommended to have a proper
mono-spaced font installed on your system. The archive
nerdfonts.com
has fonts which come with all
emojis and other symbols which also work as a Terminal font. Install the
downloaded fonts in your operating system:
- MacOS: Select the font files, right-click ->
Open with
->FontBook
. - Windows: Select the font files, right-click ->
Install
. - Linux: Use the distribution specific workflow or
read here.
On Ubuntu, right-click ->
Open with
->Font Viewer
->Install
.
We recommend the JetBrainsMono Nerd Font as it's a very well designed programming font.
Terminal
On every system its important to configure your terminal correctly. We recommend the following open-source terminals to have installed:
-
brew install --cask wezterm # or
brew install --cask iterm2 -
Windows:
wezterm
and/orWindows Terminal
Setup the terminal font to match the fonts downloaded above.
Wezterm is platform independent and recommended because of this.
A configuration setup can be found here:
wezterm.lua
The shell (e.g. zsh
or bash
etc.) is not the same as the terminal. The
terminal hosts the shell of your choice and renders the output with the
fonts configured.
Shell
Every developer needs a proper shell setup. This improves visibility and avoiding errors. Setting up a shell with a nice prompt and proper fonts is not that easy.
On macOS and Linux systems we recommend to use zsh
with some plugins:
- macOS:
brew install zsh
(always do that as macOSzsh
is out-dated.) - Linux: Install
zsh
over your package manager or withbrew
.
A properly structured Shell setup which gives you a nice prompt is directly available with the dotfiles setup and works out of the box.
Dotfiles
The dotfile setup manages dotfiles
with chezmoi
and sets up zsh
and git
for your work. Its a template
repository to use for your own maintained dotfiles. Imagine having the same
setup on your home machine and your work machine 🥳.
Utilities
The following powerful utilities are recommended to be installed since they improve development by a lot. All utilities come with some learning-curve from steep (📗), moderate (📘) to flat (📙).
-
direnv
(📗) is an utility to augment your shell per-project. E.g. in a Nix enabled project its often used to directly put you into a development shell when you enter the Git repository. The dotfiles setup already includes the setup to hookdirenv
intozsh
andbash
. -
zoxide
(📗) is a smartercd
command which remembers where the working directories. Enable you to jump to a directory with a few key-strokes likez <fuzzy-pattern>
. The dotfiles setup already includes the setup to hookdirenv
intozsh
andbash
. -
lazygit
(📗) is a terminal UI utility to quickly dogit commit
&git push
and more. -
tmux
( 📘 - 📙) is a terminal multiplexer which lets you have multiple sessions (with split windows/panes) which persist when you accidentally close the terminal. You can also achieve this by usingwezterm
with its workspace feature. -
chezmoi
(📗) orhome-manager
(for advanced users using Nix already, 📙) which both let you manage configuration files across machines. The template setup in this section is build withchezmoi
.
All utilities also have some config setup which are not part in
dotfiles
. Maintained examples can be
found here.
Nix Package Manager
Having the Nix package manger on your system gives you the flexibility to work in Nix-enabled projects without having the toolchain/requirements installed on your system manually but through Nix shells which maintain software in an unprecedented and stable way.
See instructions here..
Integrated Development Environment (IDE)
If you don't have your preferred editor setup, we suggest the following
-
a
code
setup or -
a
neovim
setup with eitherastronvim
(recommended) ornvchad
Decent maintained
astronvim
setups can be seen here:Micah Halter
(founder ofastronmvim
).Gabriel Nützi