Skip to content

My dotfiles and other things for WSL 1.0 on a Windows machine.

Notifications You must be signed in to change notification settings

rpeloff/WSL-dotfiles

Repository files navigation

dotfiles

My dotfiles and other setup things for WSL 1.0 on a Windows machine.

dotfile
noun
plural noun: dotfiles

  1. Dotfiles are plain text configuration files on Unix-y systems for things like our shell, ~/.zshrc, our editor in ~/.vimrc, and many others. They are called "dotfiles" as they typically are named with a leading . making them hidden files on your system, although this is not a strict requirement. [source]

This guide will take you through my basic setup for software development and data science work (mostly in Python) on WSL. We start by setting up and installing a few useful tools, followed by the configuration of these tools by installing the dotfiles in this repository.

Table of Contents

Create SSH keys

Generate Ed25519 SSK keys for authenticating secure services (e.g. GitHub, AWS DevOps, etc.):

$ ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "username@domain.com"
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_ed25519

Add the generated public key to GitHub and other auth services:

$ cat ~/.ssh/id_ed25519.pub

Install Oh My Zsh

In case you have not heard of Oh My Zsh, read this ... 🙃

Oh My Zsh will not make you a 10x developer...but you may feel like one.

Once installed, your terminal shell will become the talk of the town or your money back! With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, "that is amazing! are you some sort of genius?"

Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬

First install Zsh:

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install zsh

Then install Oh My Zsh:

via curl

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

via wget

$ sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Change your default shell to zsh when prompted.

Powerlevel10k theme for Oh My Zsh

There are many themes available for Oh My Zsh. I have included the Powerlevel10k theme as a git submodule that can be installed along with the dotfiles (see the Yadm bootstrap program for installation).

I have also included a configuration for this theme. You can re-configure the Powerlevel10k theme at the end of the dotfiles installation by deleting the .p10k.zsh dotfile and restarting your terminal.

Consult the Oh My Zsh documentation for guidance if you would like to select another theme (such as the Bullet Train theme).

Install a powerline compatible font

Powerline adds visual magic to your terminals. To make this work, you need to install a powerline font and configure your WSL terminal to use this font.

Nerd fonts work great with powerline. You can also install powerline fonts, but these fonts are not maintained with as many glyphs and do not work as well with themes like Powerlevel10k.

I like working with the Meslo Nerd Font (see preview), a customized version of Apple's Menlo. In particular, I use the Meslo Nerd Font patched for Powerlevel10k.

Font installation

Download these four ttf files:

Double click each of the .ttf files and select "Install" on the top left of the Windows Font Viewer. The MesloLGS NF will be available to all application on your system.

In your favorite terminal (mine is the Fluent Terminal, find it in the Microsoft Store), locate the settings dialog and set the terminal font family to MesloLGS NF or whichever powerline compatible font you choose to install.

Install tmux

I use tmux for managing terminal sessions. If you use tmux, install it now and start managing your sessions the smart way:

$ sudo apt install tmux

.tmux configuration

I have included a .tmux configuration file as a git submodule that can be installed along with the dotfiles (see the Yadm bootstrap program for installation). This makes tmux fun and easier to use.

Install pyenv

pyenv is a simple and useful tool for Python version management. This allows you to develop, test, and run applications in multiple versions of Python. In particular, it helps you avoid using the Python provided with the system (looking at you python3). The reason for this is that Python is used by the Linux OS itself and so you might want to avoid breaking it.

I have included pyenv as a git submodule that can be installed along with the dotfiles (see the Yadm bootstrap program for installation). If you plan to use it and install one or more Python versions, first install the Python build dependencies:

$ sudo apt-get update
$ sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

After the dotfiles installation, you can install and manage multiple Python versions with pyenv. For example, download and install Python 3.7.7:

$ pyenv install 3.7.7

See here for more information on how to use the pyenv commands.

pyenv-virtualenv

I have also included pyenv-virtualenv as a git submodule that can be installed along with the dotfiles (see the Yadm bootstrap program for installation). This is a plugin for pyenv, enabling features to conveniently manage virtualenvs.

This helps keep your Python installations clean and manage your project dependencies. Isolate your development environments in virtualenvs!

Install Poetry

Poetry is an elegant tool that make Python packaging and dependency management a breeze. Many are switching from pipenv to Poetry (for example, see this Python dev environment).

Install Poetry with the recommended installer:

$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3

Note: I have tried using the pipx installation and had trouble getting pyenv and Poetry to co-operate. The recommended installer works best for me.

Poetry supports completion scripts. Enable this for Oh My Zsh as follows:

mkdir $ZSH_CUSTOM/plugins/poetry
poetry completions zsh > $ZSH_CUSTOM/plugins/poetry/_poetry

Install Yadm and clone the dotfiles

I use yadm (Yet Another Dotfiles Manager) to manage my dotfiles. Yadm is based on git and greatly simplifies the process of storing dotfiles in a single repository, while making sure that they are installed into the right locations.

Install yadm:

$ git clone https://github.com/TheLocehiliosan/yadm.git ~/.yadm-project
$ sudo ln -s ~/.yadm-project/yadm /usr/local/bin/yadm

Now clone (i.e. install) the dotfiles with yadm:

$ yadm clone https://github.com/rpeloff/WSL-dotfiles.git

Yadm bootstrap program: install additional tools

You will be prompted to execute a yadm bootstrap program when cloning the dotfiles. This is recommended and will install the following tools/themes:

Alternatively, the bootstrap program can be executed at a later stage with yadm bootstrap.

Finally, restart your terminal for changes to take effect.