chopfitzroy / dotfiles-experiment

Dotfiles ๐Ÿ”ฎ
2 stars 2 forks source link

Dotfiles ๐Ÿ’ป

Goals of this repo:

Automatic Setup with Ansible ๐Ÿƒ

The Ansible script currently supports macOS using Homebrew and openSUSE (Tumbleweed).

Cloning โš—

Start by forking this repository to your own GitHub account.

Clone the repository using the following command (substituting your own values):

git clone git@github.com:{{ user_name }}/{{ repository }}.git

Create variables ๐Ÿฆˆ

You will need to create a variables file that defines a few variables related to your machine.

We ignore this file by default because it will change from machine to machine, if you only have one machine you work on feel free to commit this file.

To create this file run:

touch vars/system.yml

Now paste (and update) the below snippets, we maintain both macOS and openSUSE examples:

macOS:

# Git
git_user: user@email.com

# System directories
local_bin: "{{ ansible_user_dir }}/.local/bin"
vendor_bin: /opt/homebrew/bin # // Use '/usr/local/bin' for older (non m1) devices
config_dir: "{{ ansible_user_dir }}/.config"
local_share: "{{ ansible_user_dir }}/.local/share"

# Tools & applications
asdf_home: "{{ ansible_user_dir}}/.asdf"
asdf_bin: "{{ asdf_home }}/bin"
wezterm_dir: "{{ config_dir }}/wezterm"
zsh_completions: "{{ ansible_user_dir }}/.zsh_completions"

openSUSE:

# Git
git_user: user@email.com

# System directories
local_bin: "{{ ansible_user_dir }}/.local/bin"
vendor_bin: /usr/bin
config_dir: "{{ ansible_user_dir }}/.config"
local_share: "{{ ansible_user_dir }}/.local/share"

# Tools & applications
asdf_home: "{{ ansible_user_dir}}/.asdf"
asdf_bin: "{{ asdf_home }}/bin"
# Use "/mnt/c/Users/{{ windows_user_name }}/.config/wezterm" when using WSL on Windows (substitute your windows username)
wezterm_dir: "{{ config_dir }}/wezterm"  
zsh_completions: "{{ ansible_user_dir }}/.zsh_completions"

NOTE: Unlike vars/system.yml the vars/config.yml is intended to be tracked with git on the grounds that these options should be synchronized between all machines.

Setup for openSUSE ๐ŸฆŽ

Install ansible with the following command:

sudo zypper install ansible

Setup for macOS ๐Ÿ

Install ansible with the following command:

brew install ansible

Full install โšก

Run the entire playbook with the following command in the project directory:

ansible-playbook main.yml --ask-become-pass

Partial installs โ›…

In the event that you to perform a partial installation you can mask use of Ansible tags. An example of what this might look like:

ansible-playbook main.yml --tags "asdf,node,deno" --ask-become-pass

Please refer to main.yml to get an understanding of which tags are available.

Synchronising changes ๐Ÿ”

The Ansible scripts have been designed to be deterministic meaning you can run them an infinite number of times and they should always work.

Synchronising latest changes can always be done using the following command:

ansible-playbook main.yml --ask-become-pass

Alternatively if you just have config changes a faster option is:

ansible-playbook main.yml --tags "rsync,config" --ask-become-pass

Or use config-{{ name }} to update only one config:

ansible-playbook main.yml --tags "rsync,config-helix" --ask-become-pass

NOTE: rsync installs a required package for Ansible synchronize, if it is already installed you can omit this tag.

Language support ๐Ÿ’ฌ

If running the Ansible scripts the following software will be installed:

Finally we utilize asdf for languages that do not have an official way to manage versions.

Known issues ๐Ÿ’ฃ

Reasoning ๐Ÿ”ฎ

Below are some brief reasonings behind each software I have chosen to use.

In terms of managing dotfiles I have written about the topic extensively in my knowledgebase.

Tools ๐Ÿ‘พ

Any tool that requires significant configuration has been documented seperately, below are links to each document:

Command line utilities โšก

There are a large number of command line utilities being developed by the open source community. Below is a list of all of the utilities included in this repo.

Development:

Navigation:

Shell:

Misc:

Theming ๐ŸŒˆ

Theming is hugely personal but below are some notes to get you started.

Fonts ๐Ÿ†Ž

Below are a number of fonts I have used (or wanted to use) over the years, I have split them into premium meaning there is a cost associated with them and free meaning they can be used for personal use (or in some cases commercial use) at no cost.

Premium:

I use Berkeley Mono Typeface exclusively these days and absolutely love it. Yes I paid the $75.00 and it was worth every penny.

Free:

Color scheme ๐ŸŽจ

If you are like me and you want all your application to use the same color scheme there are a couple of limitations you need to be aware of.

Essentially there are 5 applications you need to theme fzf, bat, nap, Helix, and WezTerm. These all have their own theme engines so you are effectively limited to themes supported by all 6 applications.

Here are some tips for finding themes for each application:

Future Improvements ๐ŸŽ‰

Below are a list of future improvements I would like to make to this repository.

Gotchas โš 

Below are some common gotchas and how to fix them.

GitHub API limit ๐Ÿ’ฅ

It is possible to hit the upper limit of GitHub API interactions if the Ansible playbook is being run repeatedly.

You can get around this by running the following command substituting in your own token:

ansible-playbook main.yml --ask-become-pass --extra-vars="github_token={{ token_value }}"

asdf reshim ๐Ÿ—ก

When installing global packages (i.e with npm) these packages will not be reshimmed automatically.

To reshim all packages run:

asdf reshim

Experiments ๐Ÿงช

Below are some of the experiments that I have tried over the years either didn't make it into my dotfiles or were removed.

Emacs

I tried to love Emacs while becomming aquainted with Clojure but try as I might I couldn't make it stick.

I have written about my experience with editors ad nauseam in my knowledgebase.

Terminal docs ๐Ÿงพ

I really wanted a terminal based workflow for quickly looking up language documentation when needed.

I tried both cht.sh and dasht but neither really stuck in the way I wanted.

For now I have setup a custom search engine for devdocs.io which is still relatively fast and has the advantage of correctly rendering the MDN examples.

If you want to do this yourself the URL you will need is below, note %s refers to the search term placeholder.

https://devdocs.io/#q=%s

In the future I would like to explore doing something like this for a more terminal centric workflow.

Markdown knowledge base ๐Ÿง 

I originally tried to create my own markdown knowledge base rendered in the terminal via Glow.

Unfortunately this didn't quite have the flow I wanted.

I had varying success with Silver Bullet but it encourages editing via the browser and I would much prefer to stay in my editor.

Now I am using Helix with Marksman and this is working well.

If you are interested in building your own knowledge base here is mine.

References ๐Ÿ“š

The below resources were quintessential in creating this repository.