Skip to content

Commit

Permalink
Refactor and update the codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
kplachkov authored Dec 29, 2024
1 parent 5b6ed18 commit 103c832
Show file tree
Hide file tree
Showing 76 changed files with 318 additions and 1,189 deletions.
6 changes: 0 additions & 6 deletions .bashrc.d/aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,3 @@ alias ll='ls -alhF'
alias la='ls -A'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

# Add an "alert" alias for long running commands. Use like so:
# $ sleep 10; alert
alias alert='notify-send --urgency=critical -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')" && printf "\7"'
2 changes: 0 additions & 2 deletions .bashrc.d/completions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ _have minikube && source <(minikube completion bash)
# shellcheck disable=SC1090
_have kubectl && source <(kubectl completion bash)

_have pipenv && eval "$(pipenv --completion)"

if _have pip3; then
_pip_completion() {
# shellcheck disable=SC2207
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v3

- name: "Test installation"
run: make install
run: make auto-install

lint:
name: "Lint"
Expand Down
34 changes: 17 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
.vscode

*.zip
/config/jetbrains/codestyles/Default.xml
/config/jetbrains/colors/_@user_Darcula.icls
/config/jetbrains/colors/_@user_Default.icls
/config/jetbrains/colors/_@user_High ontrast.icls
/config/jetbrains/options/applicationLibraries.xml
/config/jetbrains/options/docker.xml
/config/jetbrains/options/jdk.table.xml
/config/jetbrains/options/remote-servers.xml
/config/jetbrains/options/databaseDrivers.xml
/config/jetbrains/options/FeatureSuggester.xml
/config/jetbrains/options/ide-features-trainer.xml
/config/jetbrains/options/go.sdk.xml
/config/jetbrains/options/laf.xml
/config/jetbrains/options/nodejs.xml
/config/jetbrains/options/updates.xml
/config/jetbrains/installed.txt
/config/jetbrains/IntelliJ IDEA Global Settings
/.config/jetbrains/codestyles/Default.xml
/.config/jetbrains/colors/_@user_Darcula.icls
/.config/jetbrains/colors/_@user_Default.icls
/.config/jetbrains/colors/_@user_High ontrast.icls
/.config/jetbrains/options/applicationLibraries.xml
/.config/jetbrains/options/docker.xml
/.config/jetbrains/options/jdk.table.xml
/.config/jetbrains/options/remote-servers.xml
/.config/jetbrains/options/databaseDrivers.xml
/.config/jetbrains/options/FeatureSuggester.xml
/.config/jetbrains/options/ide-features-trainer.xml
/.config/jetbrains/options/go.sdk.xml
/.config/jetbrains/options/laf.xml
/.config/jetbrains/options/nodejs.xml
/.config/jetbrains/options/updates.xml
/.config/jetbrains/installed.txt
/.config/jetbrains/IntelliJ IDEA Global Settings
13 changes: 5 additions & 8 deletions .profile.d/exports.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# shellcheck disable=SC2148

export EDITOR="code --wait --new-window"
export VISUAL="code --wait --new-window"
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export MANROFFOPT="-c"
export BROWSER="google-chrome"

# Don't put duplicate lines or lines starting with space in the history.
export HISTCONTROL=ignoreboth
# Increase the maximum number of commands recorded.
Expand All @@ -26,9 +20,12 @@ export POWERLINE_BASH_CONTINUATION=1
export POWERLINE_BASH_SELECT=1

export HOMEBREW_NO_ANALYTICS=1
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

# Set PATH so it includes user's private bin.
_have /home/linuxbrew/.linuxbrew/bin/brew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

_have code && export EDITOR="code --wait --new-window" && export VISUAL="code --wait --new-window"

_have bat && export MANPAGER="sh -c 'col -bx | bat -l man -p'" && export MANROFFOPT="-c"

if [ -d "$HOME/bin" ]; then
PATH="$HOME/bin:$PATH"
Expand Down
226 changes: 213 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,219 @@
.PHONY: install
##@ General

check: fmt lint
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

fmt: ## format code
shfmt -w -s .
auto-install: ## Run automated installation.
@./install.sh

lint: ## run lint check
shfmt -d -s .
shellcheck $$(shfmt -f .)
##@ Operating systems

install: ## install the setup
@install/main.sh
OS_NAME = $(shell make os-name)
OS_ID = $(shell make os-id)

fingerprint: ## generate SHA-256 fingerprint of the dotfiles
@git ls-files | xargs -I {} sha256sum "{}" | cut -d " " -f 1 | sha256sum | cut -d " " -f 1
fedora-workstation: configuration gnome dnf-packages tpm ## Install Fedora Workstation setup.

help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort
ubuntu-desktop: configuration gnome apt-packages tpm ## Install Ubuntu Desktop setup.
sudo ubuntu-drivers autoinstall

sudo sed -E -i '/(en_US.UTF-8|en_GB.UTF-8)/s/^# //g' /etc/locale.gen
sudo locale-gen
sudo update-locale \
LANG='en_US.UTF-8' \
LC_ADDRESS='en_US.UTF-8' \
LC_NAME='en_US.UTF-8' \
LC_MONETARY='en_US.UTF-8' \
LC_PAPER='en_GB.UTF-8' \
LC_IDENTIFICATION='en_US.UTF-8' \
LC_TELEPHONE='en_US.UTF-8' \
LC_MEASUREMENT='en_GB.UTF-8' \
LC_TIME='en_GB.UTF-8' \
LC_NUMERIC='en_GB.UTF-8'

macos: configuration homebrew homebrew-packages tpm ## Install macOS setup.

github-codespaces: configuration apt-packages tpm ## Install GitHub Codespaces setup.

os-name: ## Display the name of the OS.
@grep -oP '^NAME="?\K[a-zA-Z0-9_ ]+' /etc/os-release || uname

os-id: ## Display the ID of the OS.
@grep -oP '^ID="?\K[a-zA-Z0-9_ ]+' /etc/os-release || uname

##@ Desktop environments

gnome: ## Apply GNOME settings.
# Keybindings.
gsettings set org.gnome.desktop.wm.keybindings switch-applications "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-group "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-group-backward "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-windows "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-windows-backward "[]"
gsettings set org.gnome.shell.keybindings toggle-application-view "[]"
gsettings set org.gnome.settings-daemon.plugins.media-keys logout "['<Control><Super>End']"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-right "['<Control><Super><Shift>Right']"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-left "['<Control><Super><Shift>Left']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "['<Super>Above_Tab', '<Control><Super>Right']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "['<Shift><Super>Above_Tab', '<Control><Super>Left']"
gsettings set org.gnome.desktop.wm.keybindings show-desktop "['<Super>d']"
gsettings set org.gnome.desktop.wm.keybindings cycle-windows "['<Super>Tab']"
gsettings set org.gnome.desktop.wm.keybindings cycle-windows-backward "['<Shift><Super>Tab']"
gsettings set org.gnome.desktop.wm.keybindings toggle-fullscreen "['<Alt>F11']"
gsettings set org.gnome.desktop.wm.keybindings close "['<Shift><Super>q']"

# Keyboard.
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'bg+phonetic')]"
gsettings set org.gnome.desktop.input-sources per-window true
gsettings set org.gnome.desktop.a11y.keyboard mousekeys-enable true
gsettings set org.gnome.desktop.a11y.keyboard mousekeys-max-speed 1100
gsettings set org.gnome.desktop.a11y.keyboard mousekeys-init-delay 60
gsettings set org.gnome.desktop.a11y.keyboard mousekeys-accel-time 600
gsettings set org.gnome.desktop.a11y.keyboard mousekeys-accel-time 600

# Night light.
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-automatic false
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-from 5
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-to 5
gsettings set org.gnome.settings-daemon.plugins.color night-light-temperature 2700

# Power.
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend'
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 5400
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 3600

# Appearance.
gsettings set org.gnome.desktop.interface clock-show-date true
gsettings set org.gnome.desktop.interface clock-show-weekday true
gsettings set org.gnome.desktop.interface clock-format '24h'
gsettings set org.gnome.desktop.interface show-battery-percentage true

# Miscellaneous.
gsettings set org.gnome.system.locale region 'en_GB.UTF-8'
gsettings set org.gnome.desktop.media-handling autorun-never true
gsettings set org.gnome.desktop.privacy send-software-usage-stats false
gsettings set org.gnome.desktop.privacy report-technical-problems false
gsettings set org.gnome.mutter center-new-windows true
gsettings set org.gtk.Settings.FileChooser show-hidden true
gsettings set org.gtk.Settings.FileChooser sort-directories-first true
gsettings set org.gnome.nautilus.preferences show-delete-permanently true
gsettings set org.gnome.nautilus.preferences show-hidden-files true

##@ Software

dnf-packages: ## Install DNF packages.
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc && \
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' && \
dnf check-update && \
sudo dnf install -y code

sudo dnf install -y \
lshw \
nmap \
powerline \
powerline-fonts \
tmux \
tmux-powerline \
htop \
iftop \
bat \
alacritty

apt-packages: ## Install APT packages.
sudo apt-get update && sudo apt-get upgrade -y

sudo apt-get install -y \
curl \
whois \
net-tools \
apt-transport-https \
ca-certificates \
gnupg \
software-properties-common \
nmap \
htop \
iftop \
tmux \
tree \
xclip \
powerline \
fonts-powerline \
bat \
git \
cmake \
ruby-dev \
shc \
python3-pip \
pipenv \
python3-tk \
libseccomp-dev \
protobuf-compiler \
imagemagick \
gimp

homebrew-packages: ## Install Homebrew packages.
brew install go
brew install node
brew install helm
brew install kubectl
brew install minikube
brew install k9s
brew install lazygit
brew install shellcheck
brew install shfmt
brew install hugo

homebrew: ## Install Homebrew.
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew analytics off

tpm: ## Install Tmux Plugin Manager.
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

##@ Common

configuration: ## Apply configurations of packages and dotfiles.
cp -r .profile.d ~/.profile.d
cp -r .bashrc.d ~/.bashrc.d
cp -r .config/alacritty ~/.config/alacritty
cp -r .config/powerline ~/.config/powerline
cp -r .config/lazygit ~/.config/lazygit
cp -r .config/htop ~/.config/htop
cp .bash_profile ~/
cp .bashrc ~/
cp .gitconfig ~/
cp .inputrc ~/
cp .npmrc ~/
cp .tmux.conf ~/

-test "$(OS_ID)" = "fedora" && printf '%s\n\n%s\n%s\n' \
'# Code generated by dotfiles.' \
"export POWERLINE_BASH_CONFIG='/usr/share/powerline/bash/powerline.sh'" \
"export POWERLINE_TMUX_CONFIG='/usr/share/tmux/powerline.conf'" > ~/.profile.d/exports.df.sh

-test "$(OS_ID)" = "ubuntu" && printf '%s\n\n%s\n%s\n' \
'# Code generated by dotfiles.' \
"export POWERLINE_BASH_CONFIG='/usr/share/powerline/bindings/bash/powerline.sh'" \
"export POWERLINE_TMUX_CONFIG='/usr/share/powerline/bindings/tmux/powerline.conf'" > ~/.profile.d/exports.df.sh

gpg-key: ## Generate GPG key.
@gpg --full-generate-key

ssh-keys: ## Generate SSH keys.
@echo "$(USER) - $(OS_NAME)" > /tmp/identity
ssh-keygen -q -t rsa -b 4096 -C "$$(cat /tmp/identity)" -f ~/.ssh/id_rsa
ssh-keygen -q -t ed25519 -C "$$(cat /tmp/identity)" -f ~/.ssh/id_ed25519

default-apps: ## Set default applications.
xdg-mime default code.desktop text/plain

##@ Development

fmt: ## Format code.
@shfmt -w -s .

lint: ## Lint code.
@shfmt -d -s .
@shellcheck $$(shfmt -f .)
37 changes: 15 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,22 @@ The Software Engineer's setup (dotfiles, packages, desktop environment settings,
## Installation

```shell
bash -c "$(wget -qO - https://raw.githubusercontent.com/kplachkov/dotfiles/master/install/main.sh)"
make auto-install
```

High level representation of the installation process:
Supported operating systems:
- Fedora Workstation
- Ubuntu Desktop
- macOS
- GitHub Codespaces

- Downloading the repository (by default it is done at `~/projects/dotfiles`, use `DOTFILES_PATH` to change the
location).
- Installing packages.
- Configuring the settings of the desktop environment.
- Generating PGP keys, SSH keys and firewall rules (requires input).
- Linking the configurations of packages and the dotfiles (if the files already exist -- they will be replaced).
High level representation of the automated installation:
1. The automation determines the OS.
2. The configurations of packages and the dotfiles are applied (if the files already exist -- they will be replaced).
3. The settings of the desktop environment are applied.
4. Software is installed.

Installation types based on operating systems:

- Full installation:
- Fedora
- Ubuntu

- Partial installation (some packages may not be installed, and some configurations may be missing):
- RHEL-based distributions (excluding Fedora)
- Debian-based distributions (excluding Ubuntu)

- Minimal installation (only the dotfiles and few packages and configurations will be installed):
- Arch-based distributions
- openSUSE-based distributions
- macOS
More information:
```shell
make help
```
13 changes: 0 additions & 13 deletions bin/gtmux.sh

This file was deleted.

Loading

0 comments on commit 103c832

Please sign in to comment.