Skip to content

SQuent/dotfiles

Repository files navigation

Dotfiles

Welcome to my Dotfiles repository! This collection contains all the configurations for my personal machines and servers.


What are Dotfiles?

Dotfiles are hidden configuration files (prefixed with a .) in Unix-like systems. They store settings for shells, editors, and various tools, allowing for easy customization and consistency across different environments.


Why Store Dotfiles in Git?

  • Effortless Deployment: Easily set up new environments.
  • Synchronization: Keep your settings synced across multiple devices.
  • Rollback: Revert changes with ease.
  • Backup: Ensure nothing is lost.

Dotbot: The Dotfile Manager

I use Dotbot to manage these dotfiles. It not only handles symlinks but also manages package installations and scripts. Symlinks allow you to maintain all your dotfiles in a central Git directory, linking them to the appropriate locations on disk.


Installation Modes

  • Personal Machines: Full setup including all configurations and packages.
  • Servers: Minimal setup with terminal configurations and fewer packages.

Getting Started

Personal Machine Installation:

git clone https://github.com/SQuent/dotfiles.git && cd dotfiles && ./install

[Clone the repository] and run the installation script.

Server Installation:

git clone https://github.com/SQuent/dotfiles.git && cd dotfiles && ./install -l

[Clone the repository] and run the server installation script with the -l option.

Testing in Docker

You can build an image for both:

Personnal Machine:

git clone https://github.com/SQuent/dotfiles.git && cd dotfiles
docker build . -t dotfiles:light -f Dockerfile.light --progress=plain 
docker run -it dotfiles:light

Server:

git clone https://github.com/SQuent/dotfiles.git && cd dotfiles
docker build . -t dotfiles:full -f Dockerfile --progress=plain 
docker run -it dotfiles:full

Dotbot in Action

Installation Script

The installation script is a wrapper around Dotbot with the following features:

  • Manages both personal and server deployments.
  • Logs actions to install.log.
  • Checks and installs prerequisites (e.g., apt update, python3, git, curl).
  • Syncs and updates Dotbot plugins via git submodules.
  • Executes Dotbot with apt packages installation to get prerequisites for other actions.
  • Executes all Dotbot steps except apt packages installation.

Dotbot Steps

  1. Clean the ~/ directory.
  2. Create necessary folders.
  3. Link configuration files with symlinks.
  4. Install APT packages.
  5. Install Homebrew and packages if not already installed.
  6. Install npm packages.
  7. Configure the shell environment.

Features

XDG Directories

Manage the location of configuration files using the XDG Base Directory Specification for a clutter-free home directory. These are declared in config/.profile.


Shell: Zsh Configuration

Zsh, or the Z Shell, is a powerful and highly customizable Unix shell that extends the Bourne shell (sh).

config/zsh
├── .zshrc
├── aliases.zsh           # Personal Aliases
├── functions.zsh         # Personal Functions
├── history.zsh           # History Management 
├── import-plugins.zsh    # Plugins to install
└── setup-antigen.zsh     # Zsh plugin installer

Plugins

Shell History Management

Handled in config/zsh/history.zsh.
I bind the arrow keys to search through the history for commands that start with the current input.


Visualization Tools

  • Starship: For a minimal, fast, and customizable prompt. Config stored in config/starship.toml.

  • EZA: Enhanced ls command for better file listing. Color:

    export EXA_COLORS="ur=34:uw=35:ux=36:gr=34:gw=35:gx=36:tr=34:tw=35:tx=36"
  • Bat: A cat clone with syntax highlighting.

    if command_exists bat ; then
      alias cat="bat -pp"
    fi

Sensitive Data

Sensitive data like secrets, SSH keys, and kubeconfigs are not committed to the dotfiles repository. These are stored in Bitwarden SAAS and managed with bitwarden-cli and functions in config/zsh/functions.zsh.

First, you need to install the CLI, create client and secret id in Bitwarden, and configure ~/.bw as follows:

export BW_CLIENTSECRET=
export BW_CLIENTID=
export BW_PSSWD=
export BW_SECRET_NOTE_ID=
export BW_SSH_FOLDER_ID=

Secret Management

Secrets are stored in a Bitwarden note (referenced by BW_SECRET_NOTE_ID). Functions to manage these secrets include:

  • load_secret: Load secrets from Bitwarden and source them.
  • clean_secret: Remove files with secrets.

SSH Keys Management

SSH key files and ssh config file are stored in a Bitwarden folder and managed using the load_ssh_keys function to populate the ~/.ssh folder.

Kubeconfig Management


Multi-Git Management

Manage multiple Git profiles (github, gitlab, personnal instance of gitlab) with direnv.
Loading environment variables in directories with specific organization repositories:

git
├── github
│   ├── helm-kuma-ingress-watcher
│   └── kuma-ingress-watcher
├── gitlab
│   ├── dotfiles
├── nas
│   └── qlabv1
└── work
    └── Infrastructure

And for each directory i have GIT VARS loaded from other environment VARS when i go to the dir:

export GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlab_id_rsa -F /dev/null"
export GIT_AUTHOR_NAME=$USER_GIT_GITLAB
export GIT_AUTHOR_EMAIL=$EMAIL_GIT_GITLAB
export GIT_COMMITTER_NAME=$USER_GIT_GITLAB
export GIT_COMMITTER_EMAIL=$EMAIL_GIT_GITLAB

Quick save file

Dropbox Management

Sometimes, you need to quick save some files in an external storage. I use Dropbox.

First, ensure that you have the Dropbox CLI tool installed and configure your Dropbox access token as follows:

export DROPBOX_PERSONAL_TOKEN=

Dropbox integration functions include:

  • load_dbx: Creates a configuration directory and sets up Dropbox CLI authentication using the DROPBOX_PERSONAL_TOKEN.

  • dbxpush: Uploads a local file or directory to /tmp directory in Dropbox. Usage example:

    dbxpush <local-file-or-directory>
  • dbxget: Downloads a file from /tmp directory in Dropbox to the local machine. Usage example:

    dbxget <remote-file>
  • dbxclean: Cleans up temporary files in Dropbox. ( including config dir with token, but not the environment var with the token)

These functions are included in config/zsh/functions.zsh, which ensures efficient management of Dropbox operations within your setup.


Multi-windows Terminal with Tmux

Tmux is a terminal multiplexer that allows you to manage multiple terminal sessions within a single window.

My Tmux configuration, stored in config/.tmux.conf, includes:

  • Mouse Support: Allows window resizing with the mouse and enables a context menu with a right-click on a window.
  • Custom Prefix Key:
    • The default prefix key (C-b) is changed to Ctrl + Space for easier access.
    • Ctrl + Space + v for vertical splits.
    • Ctrl + Space + h for horizontal splits.
    • Ctrl + Space + arrow keys (→, ←, ↑, ↓) to switch between windows.
  • Custom Screensaver: The lock screen is configured to display a cbonsai animation after 180 seconds of inactivity. This can be switched to cmatrix or asciiquarium for alternative screensavers.

Garbage Management with Trash

To avoid accidentally deleting files permanently, I use trash-cli. i replace rm by this. This tool moves files to the trash, allowing for easy recovery if needed. Aliases are set for trash management.


Editors

Neovim

Neovim is an extensible and modular text editor based on Vim. I use a pre-built version of NvChad, a framework for Neovim that provides a ready-to-use configuration with numerous plugins and enhancements.


Visual Studio Code

Visual Studio Code is a code editor developed by Microsoft.

Dotfiles for VsCode are:

  • settings.json
  • Profile

Installed Packages

APT Packages

Package Name Description In Full In Light
build-essential A package that contains the essential tools for building software, including GCC, g++, make, etc. ✔️ ✔️
curl Command line tool for transferring data with URL syntax, supports various protocols like HTTP, HTTPS, FTP, etc. ✔️ ✔️
gnupg GNU Privacy Guard, a tool for secure communication and data storage, often used for signing and encrypting data. ✔️ ✔️
lsb-release Linux Standard Base (LSB) information, provides details about the Linux distribution. ✔️ ✔️
ca-certificates Common CA certificates that help in validating SSL certificates, ensuring secure communication. ✔️ ✔️
procps A package that provides various system utilities, such as ps, top, vmstat, kill, etc., used for monitoring and managing processes. ✔️ ✔️
file A utility to determine the type of a file based on its content, often used to identify binary and text files. ✔️ ✔️
fontconfig library for configuring and customizing font access. ✔️ ✔️
zsh Z Shell, an extended version of the Bourne Shell with additional features and improvements, often used as an interactive shell. ✔️ ✔️

Brew Packages

Package Name Description In Full In Light
wget Network downloader ✔️ ✔️
watch Execute a program periodically, showing output fullscreen ✔️ ✔️
yq YAML processor (like jq for YAML) ✔️ ✔️
jq Command-line JSON processor ✔️ ✔️
trash-cli Command line interface to the freedesktop.org trashcan ✔️ ✔️
btop Better than htop ✔️ ✔️
direnv Load/unload environment variables based on $PWD ✔️ ✔️
bitwarden-cli Bitwarden command-line interface ✔️ ✔️
scc For counting the lines of code, blank lines, comment lines, and physical lines of source code in many programming languages. ✔️ ✔️
duf Get info on mounted disks (better df) ✔️ ✔️
sd RegEx find and replace (better sed) ✔️ ✔️
asdf Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more ✔️ ✔️
tmux Terminal multiplexer ✔️ ✔️
fd Simple, fast and user-friendly alternative to 'find' ✔️ ✔️
pre-commit Allow script to run on every commit ✔️
starship Minimal, blazing-fast, and infinitely customizable prompt for any shell ✔️ ✔️
eza Listing files with info (better ls) ✔️ ✔️
bat Output highlighting (better cat) ✔️ ✔️
neovim Hyperextensible Vim-based text editor ✔️ ✔️
thefuck App which corrects your previous console command. ✔️ ✔️
neofetch Show system data and distro info ✔️ ✔️
tree Display directories as trees ✔️ ✔️
poetry Python dependency management and packaging made easy ✔️
node JavaScript runtime built on Chrome's V8 JavaScript engine ✔️
libyaml YAML Parser ✔️
gitleaks secret detector ✔️
gomplate A template renderer that can be used to generate README ✔️
docker Platform to build, run, and share containerized applications ✔️
docker-compose Define and run multi-container applications with Docker ✔️
kubernetes-cli Kubernetes command-line interface ✔️
podman Tool for managing OCI containers and pods ✔️
kubectx Switch faster between clusters and namespaces in kubectl ✔️
minikube Run Kubernetes locally ✔️
kubectl Kubernetes command-line tool ✔️
kustomize Kubernetes native configuration management ✔️
kdash Kubernetes dashboard app ✔️
lazydocker Full Docker management app ✔️
helm-docs Autogenerate doc for Helm charts ✔️
kubernetes-helm The Kubernetes package manager ✔️
krew plugin manager for kubectl command-line tool. ✔️
derailed/k9s/k9s Kubernetes CLI to manage your clusters in style! ✔️
ctop Container metrics and monitoring ✔️
docker-completion Bash, Zsh and Fish completion for Docker ✔️
awscli Official Amazon AWS command-line interface ✔️
hashicorp/tap/terraform Infrastructure as code software tool ✔️
terragrunt Thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules ✔️
minio-mc MinIO Client for object storage and filesystems ✔️
tflint Terrafrom Linter ✔️
gitlab-ci-local Build all pipeline or specific job locally ✔️
act Build and test GitHub pipelines on local stack ✔️
glab CLI for GitLab ✔️
packer Tool for creating identical machine images for multiple platforms ✔️ ✔️
k3sup Bootstrap Kubernetes with k3s over SSH < 1 min ✔️
argocd-autopilot Bootstrap ArgoCD Autopilot ✔️
pwgen Password generator ✔️
fdupes Duplicate file finder ✔️
gping Interactive ping tool, with graph ✔️
httpie HTTP / API testing client ✔️
entr Run command when files change (for testing when you change code directly launch program) ✔️
ttygif Make gif from terminal ✔️
tldr Simplified and community-driven man pages ✔️
librsvg To use rsvg-convert docker-compose.svg > docker-compose.png ✔️
asciiquarium Fish tank animation in your terminal ✔️
cmatrix Console Matrix ✔️
figlet Banner-like program prints strings as ASCII art ✔️
cbonsai terminal bonzai in ASCII ✔️

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published