Dotfiles For Fun & Profit

@EliGundry

A Bit About Me

Me on Vim

I Have Way Too Many Computers

Not actually my apartment.
Actual image of my apartment

Enter Dotfiles

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. - Thoughtbot Intro to Dotfiles

Dotfiles Are A Window Into A Developer's Mind

The Bratpack?
Can You Spot The Emacs User?
"But Eli, I like to keep Vim plain so it works across machines exactly the same!"
- Someone In This Very Audience

Vanilla Vim Users

Vanilla Vim User opening Vim on a new machine
"But Eli, Vim is a text editor, don't use it like an IDE!"
- Same Person In The Audience

I ❤️ This 💩 Flies & All

Challenge

How do I maintain a consistent environment across machines?

Challenge Accepted

The Answer Is Always GitHub

Sadly Accurate
Front End Conftocat
dots.sh in action

dots.sh

/eligundry/dots

Shell Is Awesome!

Yeezus

Shell Is The Worst!

The Woooooorst

dotty.py

/vibhavp/dotty

/r/unixporn

dotty.py Syntax

    
{
  "install": [
    "vim",
    "neovim"
  ],
  "link": {
    "bashrc": "~/.bashrc",
    "vimrc": "~/.vimrc"
  },
  "copy": {
    "gitconfig": "~/.gitconfig"
  }
}
    
  
MOOOORRRE!

…But I Needed More!

/eligundry/dotty

Larry David Confused

…It Wasn't Enough

Development Environments Are Production Environments

SaltStack Logo

/eligundry/salt.eligundry.com

Dots Pillar

    
dots:
  bashrc: .bashrc
  vimrc: .vimrc
  zshrc: .zshrc
{% if grains['kernel'] == 'Linux' %}
  gtkrc-2.0: .gtkrc-2.0
{% endif %}
    
  

Dots State

    
{% set user = 'eligundry' %}
{% set dots = '/home/' + user + '/dots' }

dots-repo:
  git.latest:
    - name: https://github.com/eligundry/dots.git
    - target: {{ dots }}
    - user: {{ user }}
    - require:
      - {{ user }}

{% for src, dst in pillar['dots'].items() %}
{{ home }}/{{ dst }}:
  file.symlink:
    - target: {{ dots }}/{{ src }}
    - user: {{ user }}
    - group: {{ user }}
    - makedirs: True
    - force: True
    - require:
      - dots-repo
{% endfor %}
    
  
But wait...

There's More!

I don't want to feel this way anymore.

It's Not Perfect Yet

There Is No Right Way

Be About What You Make

Not How You Make It

Almost there

Takeaways

  • Shell Scripts Are Awesome Until You Need To Update Them
  • Treat Your Local Environment Like Production
  • Don't Be An Ass

We Made It!

Thanks for listening, you're the best, any questions?

We the best!