GithubHelp home page GithubHelp logo

eliasnorrby / dotfiles Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 2.1 MB

:computer: Dotfiles for development on MacOS and Manjaro

License: MIT License

Shell 75.50% Lua 18.01% Emacs Lisp 5.56% JavaScript 0.04% Python 0.46% Jinja 0.44%
vim emacs zsh ansible karabiner hammerspoon dotfiles dotfiles-manager dotfiles-macos arch-linux bspwm sxhkd alacritty tmux

dotfiles's Introduction

.DOTFILES

github-actions semantic-release Conventional Commits

Declarative dotfiles for development on MacOS and Manjaro.

Bootstrap

To provision a new workstation from scratch, use the setup.sh (or setup-linux.sh) script.

Run

bash <(curl -sL https://raw.githubusercontent.com/eliasnorrby/dotfiles/develop/setup.sh)

Prepare to input your password a couple of times.

This setup script will:

  • Install homebrew

  • Install python3 and openssl (using brew)

  • Download a snapshot version of this repo

  • Install ansible (using brew)

  • Install ansible role dependencies

  • Run the downloaded playbook (_provision/playbook.yml), wherein:

    • This repo is cloned to ~/.dotfiles
    • Symlinks are created
    • xcode command line tools are installed (or verified to have been installed)
    • Dependencies are downloaded (using homebrew, pip, ruby and npm)
  • Run the post-install script, wherein:

    • zsh plugins are installed
    • vim plugins are installed
    • coc-nvim extensions are installed
    • vscode plugins are installed
    • doom-emacs packages are installed

๐Ÿ• Estimated duration: ~45 minutes

Dependencies:

Directory structure

Configuration is divided into topics (inspired by hlissner).

Example topics:

  • shell/zsh
  • shell/tmux
  • editor/vim

Topics are grouped by category (editor, shell, etc). Each topic must contain a topic.config.yml, and can optionally include a topic.tasks.yml, an aliases.zsh, an env.zsh, as well as any other files relevant to its configuration.

Ansible tasks defined in topic.tasks.yml will be run during provisioning.

Environment variables defined in env.zsh will be sourced during shell startup if the topic is enabled. The same is true for aliases defined in aliases.zsh.

.dotfiles
โ””โ”€โ”€ group
 ย ย  โ”œโ”€โ”€ topic
    โ”‚   โ”œโ”€โ”€ aliases.zsh
    โ”‚   โ”œโ”€โ”€ env.zsh
    โ”‚   โ”œโ”€โ”€ topic.config.yml
 ย ย  โ”‚ย ย  โ””โ”€โ”€ topic.tasks.yml
 ย ย  โ””โ”€โ”€ another-topic

Minimal example of a topic directory layout

Extended directory layout example
.dotfiles
โ”œโ”€โ”€ editor
โ”‚ย ย  โ”œโ”€โ”€ editorconfig
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ topic.config.yml
โ”‚ย ย  โ”œโ”€โ”€ emacs
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ aliases.zsh
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ topic.config.yml
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ doom
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ config.el
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ init.el
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ packages.el
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ env.zsh
โ”‚ย ย  โ””โ”€โ”€ vim
โ”‚ย ย      โ”œโ”€โ”€ aliases.zsh
โ”‚ย ย      โ”œโ”€โ”€ env.zsh
โ”‚ย ย      โ”œโ”€โ”€ gvimrc.vim
โ”‚ย ย      โ””โ”€โ”€ topic.config.yml
โ””โ”€โ”€ shell
ย ย  โ”œโ”€โ”€ alacritty
ย ย  โ”‚ย ย  โ”œโ”€โ”€ alacritty.yml
ย ย  โ”‚ย ย  โ”œโ”€โ”€ aliases.zsh
ย ย  โ”‚ย ย  โ””โ”€โ”€ topic.config.yml
ย ย  โ”œโ”€โ”€ git
ย ย  โ”‚ย ย  โ”œโ”€โ”€ aliases.zsh
ย ย  โ”‚ย ย  โ””โ”€โ”€ topic.config.yml
ย ย  โ”œโ”€โ”€ tmux
ย ย  โ”‚ย ย  โ”œโ”€โ”€ aliases.zsh
ย ย  โ”‚ย ย  โ”œโ”€โ”€ env.zsh
ย ย  โ”‚ย ย  โ”œโ”€โ”€ scripts
ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ uptime-tmux-status.sh
ย ย  โ”‚ย ย  โ”œโ”€โ”€ tmux-cheatsheet.md
ย ย  โ”‚ย ย  โ”œโ”€โ”€ tmux.conf
ย ย  โ”‚ย ย  โ”œโ”€โ”€ tmux.remote.conf
ย ย  โ”‚ย ย  โ”œโ”€โ”€ tmux.theme.conf
ย ย  โ”‚ย ย  โ””โ”€โ”€ topic.config.yml
ย ย  โ””โ”€โ”€ zsh
ย ย      โ”œโ”€โ”€ aliases.zsh
ย ย      โ”œโ”€โ”€ completion.zsh
ย ย      โ”œโ”€โ”€ config.zsh
ย ย      โ”œโ”€โ”€ fzf.zsh
ย ย      โ”œโ”€โ”€ keybinds.zsh
ย ย      โ”œโ”€โ”€ macos.zsh
ย ย      โ”œโ”€โ”€ plugins.zsh
ย ย      โ”œโ”€โ”€ prompt.zsh
ย ย      โ”œโ”€โ”€ remote.zsh
ย ย      โ”œโ”€โ”€ utilities.zsh
ย ย      โ”œโ”€โ”€ topic.config.yml
ย ย      โ””โ”€โ”€ topic.tasks.yml

Each topic declares its configuration (brew dependencies, symlinks, etc) in a topic.config.yml within its coresponding directory.

vim_config:
  path: editor/vim
  links:
    - .vimrc
  brew_formulas:
    - vim

Topic configuration example

Possible fields in topic.config.yml:

  • path (required)
  • links
  • become
  • brew_formulas
  • brew_casks
  • brew_taps
  • pacman_packages
  • aur_packages
  • osx_defaults
  • npm_packages
  • pip_packages
  • gem_packages
  • mas_apps

โ€ผ๏ธ TODO: Describe topic config api in detail.

Each topic configuration is mapped to root.config.yml:

topics:
  editor:
    - name: vim
      state: present
      config: "{{ vim_config }}"
    - name: emacs
      state: present
      config: "{{ emacs_config }}"
    - name: editorconfig
      state: disabled
      config: "{{ editorconfig_config }}"
  keyboard:
    - name: hammerspoon
      state: present
      config: "{{ hammerspoon_config }}"
    - name: karabiner
      state: present
      config: "{{ karabiner_config }}"
  shell:
    - name: tmux
      state: present
      config: "{{ tmux_config }}"
    - name: zsh
      state: present
      config: "{{ zsh_config }}"
  lang:
    - name: java
      state: present
      config: "{{ java_config }}"
    - name: go
      state: absent
      config: "{{ go_config }}"

Root dotfile configuration example

In root.config.yml, topics can be enabled/disabled/removed by setting their state to one of present, disabled or absent. Upon running,

  • present topics will have their symlinks created (if they don't exist already) and their dependencies installed
  • disabled topics will have their symlinks removed (if they exist), but their dependencies left alone (if they are installed)
  • absent topics will have their symlinks removed (if they exist) and their dependencies uninstalled (if they are installed)

CLI

๐Ÿ”ง eliasnorrby/dotfiles-cli

The CLI provides a simpler way to edit, view and apply configurations.

Leftovers

After running the provisioning script, there are a few things that need to be configured manually.

General

  • Set the computer name
    • (MacOS) Preferences โ†’ Sharing
    • (Linux) sudo scutil --set HostName <name-you-want>
  • Generate ssh keys
    ssh-keygen -t ed25519 -C "[email protected]"
    gh auth login

MacOS

  • Start all apps and prepare to grant lots of privileges
    • Start with Karabiner and Hammerspoon to enable app shortcuts
  • Set main Alfred hotkey to โŒฅ + SPACE
  • Set desktop background (assets available in Dropbox)
  • Add additional desktops
  • Enable shortcuts for desktop navigation (Preferences โ†’ Keyboard โ†’ Shortcuts โ†’ Mission Control)
  • Remap layout switching shortcuts (Preferences โ†’ Keyboard โ†’ Shortcuts โ†’ Input Sources)
  • Add Amethyst padding (2 px window margin, 5 px screen padding)
  • Start Amethyst on Login (menubar configuration)
  • Configure Bartender to hide the appropriate icons, supply license
  • Import iStatMenus settings from assets/istatmenus, supply license
  • Some apps may require Rosetta to run
    • /usr/sbin/softwareupdate --install-rosetta --agree-to-license
  • Add Workman-P layout (?)

Optional

Troubleshooting

zsh: compinit complains about insecure directories

It's probably mentioning /usr/local/share/zsh. Resolve it by running e.g:

sudo chown -R eliasnorrby:admin /usr/local/share/zsh
sudo chmod -R 755 /usr/local/share/zsh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.