Skip to content

Clumsy-Coder/dotfiles

Repository files navigation

dotfiles

my configs, settings, installation scripts, etc

Quick start

Run script and use a var file (without file extension) from ./vars/

curl -fsSL https://raw.githubusercontent.com/Clumsy-Coder/dotfiles/master/bin/dotfiles.sh | bash -s -- <var filename without file extension>

example:

curl -fsSL https://raw.githubusercontent.com/Clumsy-Coder/dotfiles/master/bin/dotfiles.sh | bash -s -- fedora

Run specific role

To run a specfic role from ./roles/ directory

curl -fsSL https://raw.githubusercontent.com/Clumsy-Coder/dotfiles/master/bin/dotfiles.sh | bash -s -- <var filename> --tags <role name>

example:

curl -fsSL https://raw.githubusercontent.com/Clumsy-Coder/dotfiles/master/bin/dotfiles.sh | bash -s -- fedora --tags code-directory

example multiple roles:

curl -fsSL https://raw.githubusercontent.com/Clumsy-Coder/dotfiles/master/bin/dotfiles.sh | bash -s -- fedora --tags 'code-directory, dnf'

Usage

This repo will be using Ansible to set up dotfiles, install apps, etc

command dotfiles is used for running Ansible playbook

When running dotfiles, it expects a var file from ./vars/ directory (without the file extension). The var file must contain a var named default_roles. This var will be used to run roles stored in the ./roles

Ex: if a var file foo.yaml contains role code-directory and git in var default_roles; when running dotfiles foo, it will run roles code-directory and git

Supported OS

dotfiles bootstrapping is supported in the following OS

  • Ubuntu
  • Pop!_OS
  • Fedora

Default

dotfiles <var file>

Ex:

dotfiles fedora

Run specific roles

If you want to run a specific role, you need to provide the ansible argument --tags <role name>

dotfiles <var file> --tags <role name>

Ex:

dotfiles fedora --tags code-directory

Run multiple specific roles

To run multiple specific roles, separate the roles with a comma

dotfiles <var file> --tags 'role1, role2, role3'

Ex:

dotfiles fedora --tags 'code-directory, git, dnf'

How it works

This repo uses ansible and ansible-playbook to setup the OS

All dotfiles are stored in ./tools/ directory

./bin/dotfiles.sh

The ./bin/dotfiles.sh will

  • Check if the dotfiles repo is cloned on to the path defined in env DOTFILES_DIR
  • add a symbolic line of ./bin/dotfiles.sh to $HOME/.local/bin/dotfiles
    • run the command dotfiles from any directory
  • load file ./bin/colours.sh
  • load file ./bin/functions.sh
  • load file ./tools/zsh/.zshenv
  • load file ./tools/zsh/exports.zsh
  • install ansible on the supported OS
  • update git submodules
  • install packages from ./requirements.yaml using ansible galaxy
  • check if a var file if not provided
    • display help page
    • exit program
  • check if var file doesn't exist
    • display help page and available var file names
    • exit program
  • run ansible playbook using the var file provided

Ansible

Ansible roles are used for specific task, Ex: Installing NVM, configuring Alacritty. Some roles are OS specific.

A single ansible playbook is used. It loads a var file (provided by when executing ./bin/dotfiles.sh) which contains var default_roles that will run the listed roles

Ansible vars are used to store any variables that be used in an Ansible role. Ex: list of apps to install on homebrew The directory vars/ contains ansible var files used by ansible-playbook. Each file is corresponding to an OS.

Note

Each var file in ./vars/ directory must contain a var default_roles. It's a list of roles to run if not specified by the user Ex:

default_roles:
 - code-directory
 - apt
 - git
 - lazygit
 - neofetch
 - neovim
 - astronvim-v4
 - tmux
 - nvm

File/Folder structure

dotfiles/
├── .github/
├── bin/                            # shell scripts to run dotfiles and ansible-playbook
├── docs/                           # documentation assets. Ex: screenshots
├── meta/                           # dotbot configs and profiles. No longer in use
├── pre_tasks/                      # Task to run before anything else in ansible-playbook
├── roles/                          # Ansible roles
├── tasks/                          # Ansible tasks
├── tools/                          # dotfile configs
├── vars/                           # Ansible vars
├── .ansible-lint
├── .editorconfig
├── .gitignore
├── .gitmodules
├── .luacheckrc
├── .markdownlint.json
├── .stylua.toml
├── .yamllint
├── ansible.cfg                     # Ansible configs
├── dotbot-readme.md                # Old docs for dotbot
├── hosts                           # Ansible hosts
├── install-profile                 # used by dotbot. No longer in use
├── install-standalone              # used by dotbot. No longer in use
├── LICENSE
├── main.yaml                       # Main ansible playbook file
├── README.md
└── requirements.yaml               # Ansible Galaxy. needed before running Ansible

Inspiration

About

Dotfiles used for setting up terminal look and feel

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 3

  •  
  •  
  •