Skip to content

Commit d415e08

Browse files
committed
📝 dotfile docs
1 parent 47b4c84 commit d415e08

File tree

10 files changed

+184
-79
lines changed

10 files changed

+184
-79
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
cache/
2-
mac/Brewfile.lock.json
2+
macos/Brewfile.lock.json

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ repos:
1919
hooks:
2020
- id: prettier
2121
args: [--print-width=88, --tab-width=4]
22+
2223
- repo: https://github.com/scop/pre-commit-shfmt
2324
rev: v3.8.0-1
2425
hooks:

Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
SHELL := /bin/bash
2+
OS := $(shell uname -s)
3+
GIT := git
4+
HATCH := hatch
5+
6+
.PHONY: help
7+
help:
8+
@echo "Usage: make [TARGET] ..."
9+
@echo ""
10+
@echo "Targets:"
11+
@echo " bootstrap Initialize the project by running the bootstrap script."
12+
@echo " deps Install dependencies for the project based on the OS."
13+
@echo " docs Serve the documentation locally."
14+
@echo " fmt Run pre-commit hooks on all files."
15+
@echo " help Show this help message."
16+
@echo " sync Update the project and its submodules."
17+
18+
.PHONY: bootstrap
19+
bootstrap:
20+
$(SHELL) ./bootstrap/bootstrap.sh
21+
22+
.PHONY: deps
23+
deps:
24+
ifeq ($(OS),Linux)
25+
$(SHELL) ./bin/aptfile ./linux/Aptfile
26+
else ifeq ($(OS),Darwin)
27+
brew bundle --file=./macos/Brewfile
28+
else
29+
$(error Unsupported operating system - $(OS))
30+
endif
31+
32+
.PHONY: sync
33+
sync:
34+
$(GIT) pull --recurse-submodules --jobs=4
35+
36+
.PHONY: fmt
37+
fmt:
38+
pre-commit run --all-files
39+
40+
.PHONY: docs
41+
docs:
42+
$(HATCH) run docs:serve --livereload

README.md

Lines changed: 21 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img src="https://raw.githubusercontent.com/juftin/dotfiles/main/docs/logo.png" alt="dotfiles" width="500" />
44
</a>
55
<p align="center">
6-
my personal dotfiles for <code>zsh</code>, <code>bash</code>, and more
6+
my personal dotfiles for <code>zsh</code>, <code>bash</code>, and <i>everything else</i>
77
</p>
88
<a href="https://github.com/juftin/dotfiles/"><img src="https://img.shields.io/github/v/release/juftin/dotfiles?color=blue&label=dotfiles&logo=slashdot" alt="docs"></a>
99
<a href="https://juftin.com/dotfiles/"><img src="https://img.shields.io/static/v1?message=docs&color=526CFE&logo=Material+for+MkDocs&logoColor=FFFFFF&label=" alt="docs"></a>
@@ -14,8 +14,6 @@
1414

1515
## Installation
1616

17-
### Automatic
18-
1917
```shell
2018
curl -fsSL https://juftin.com/dotfiles/get | bash
2119
```
@@ -30,91 +28,26 @@ When using the bootstrapping script, the following steps are taken:
3028
<details><summary>🌈 Bootstrapping Screen Recording</summary>
3129
<p>
3230

33-
https://github.com/juftin/dotfiles/assets/49741340/569d7e27-114b-4378-9157-f7f9e9de52fc
31+
https://github.com/juftin/dotfiles/assets/49741340/6c04d3aa-8821-41a9-98d4-74e8b4465f58
3432

3533
</p>
3634
</details>
3735
<!--skip-->
3836

39-
#### Optional Environment Variables
40-
41-
- `DOTFILES_REPO`: The repository to clone. Default: `juftin/dotfiles`
42-
- `DOTFILES_BRANCH`: The branch to checkout. Default: `<default branch>`
43-
- `DOTFILES_DIR`: The directory to clone the repository into. Default: `~/.dotfiles`
44-
45-
> INFO:
46-
>
47-
> Try it out in a docker sandbox:
48-
>
49-
> ```shell
50-
> docker run --rm -it \
51-
> --env TERM \
52-
> --env COLORTERM \
53-
> python:latest \
54-
> /bin/bash -c \
55-
> "curl -fsSL https://juftin.com/dotfiles/get | bash && zsh"
56-
> ```
57-
58-
### Manual
59-
60-
1. Install any missing dependencies
61-
62-
```shell
63-
apt install -y git curl zsh tar gh
64-
```
65-
66-
2. Clone the repo to `~/.dotfiles`
67-
68-
```shell
69-
git clone https://github.com/juftin/dotfiles.git ~/.dotfiles
70-
```
71-
72-
3. Sync all git submodules
73-
74-
```shell
75-
cd ~/.dotfiles
76-
git submodule update --init --recursive
77-
```
78-
79-
4. Link the dotfiles
80-
81-
```shell
82-
ln -s ~/.dotfiles/bootstrap/oh-my-zsh ~/.oh-my-zsh
83-
ln -s ~/.dotfiles/bootstrap/powerlevel10k ~/.oh-my-zsh/custom/themes/powerlevel10k
84-
ln -s ~/.dotfiles/bootstrap/fast-syntax-highlighting ~/.oh-my-zsh/custom/plugins/fast-syntax-highlighting
85-
ln -s ~/.dotfiles/bootstrap/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
86-
ln -s ~/.dotfiles/bootstrap/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
87-
ln -s ~/.dotfiles/bootstrap/oh-my-bash ~/.oh-my-bash
88-
ln -s ~/.dotfiles/shell/.zshrc ~/.zshrc
89-
ln -s ~/.dotfiles/shell/.bashrc ~/.bashrc
90-
ln -s ~/.dotfiles/shell/.profile ~/.profile
91-
ln -s ~/.dotfiles/shell/.p10k.zsh ~/.p10k.zsh
92-
ln -s ~/.dotfiles/shell/.shell_aliases ~/.shell_aliases
93-
ln -s ~/.dotfiles/shell/.mac_aliases ~/.mac_aliases
94-
ln -s ~/.dotfiles/bootstrap/pyenv ~/.pyenv
95-
ln -s ~/.dotfiles/git/.gitconfig ~/.gitconfig
96-
ln -s ~/.dotfiles/git/.gitignore ~/.gitignore
97-
ls -s ~/.dotfiles/bin/aptfile /usr/local/bin/aptfile
98-
```
37+
See the documentation for more information on manual installation.
9938

10039
## Dependencies
10140

102-
### MacOS
103-
104-
Dependencies for macOS can be installed using [Homebrew](https://brew.sh/)'s `bundle` command.
41+
All packages, applications, and dependencies for this project
42+
can be installed using the provided `dotfiles-deps` command:
10543

10644
```shell
107-
brew bundle --file=~/.dotfiles/mac/Brewfile
45+
dotfiles-deps
10846
```
10947

110-
### Debian
111-
112-
Dependencies for Debian can be installed using `apt` and the `aptfile` command,
113-
which is installed alongside the dotfiles:
114-
115-
```shell
116-
aptfile ~/.dotfiles/debian/Aptfile
117-
```
48+
On macOS, this command will install dependencies using [Homebrew](https://brew.sh/)'s
49+
`bundle` command and a `Brewfile`. On Linux, this command will install dependencies using `apt-get`
50+
and an `Aptfile`.
11851

11952
## Customization
12053

@@ -123,3 +56,15 @@ files:
12356

12457
- `~/.gitconfig`
12558
- Update the `[user]` section with your own name and email
59+
60+
<!--skip-->
61+
62+
## Documentation
63+
64+
The full documentation for this project is available at
65+
[https://juftin.com/dotfiles/](https://juftin.com/dotfiles/).
66+
67+
- [Features](docs/features.md)
68+
- [Installation](docs/installation.md)
69+
70+
<!--skip-->

docs/features.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@
2424

2525
### Functions
2626

27-
- `mkcd` - make a directory and change to it
27+
#### Dotfiles Functions
28+
2829
- `dotfiles-sync` - sync the dotfiles with the remote repository
30+
- `dotfiles-bootstrap` - run the dotfile bootstrap script
31+
- `dotfiles-deps` - install the dotfiles dependencies
32+
33+
#### General Functions
34+
35+
- `mkcd` - make a directory and change to it
2936
- `log_event` - log to the console with a timestamp
3037
- `f` - search for files from the current directory recursively
3138
- `r` - grep for a string in the current directory recursively
@@ -35,9 +42,15 @@
3542
- `sync` - source the dotfiles and sync the shell
3643
- `notify` - send a notification to the desktop (macOS only)
3744

45+
#### Git Functions
46+
47+
- `git dunk` - view the diff in a pleasant ui
48+
- `g` - easy [git aliases]
49+
3850
[OhMyBash]: https://github.com/ohmybash/oh-my-bash
3951
[powerlevel10k]: https://github.com/romkatv/powerlevel10k
4052
[OhMyZsh]: https://ohmyz.sh/
4153
[zsh-users/zsh-autosuggestions]: https://github.com/zsh-users/zsh-autosuggestions
4254
[zsh-users/zsh-completions]: https://github.com/zsh-users/zsh-completions
4355
[zdharma-continuum/fast-syntax-highlighting]: https://github.com/zdharma-continuum/fast-syntax-highlighting
56+
[aliases]: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git

docs/installation.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Installation
2+
3+
## Bootstrapping
4+
5+
To install the dotfiles, run the following command:
6+
7+
```shell
8+
curl -fsSL https://juftin.com/dotfiles/get | bash
9+
```
10+
11+
Try it out in a docker sandbox:
12+
13+
```shell
14+
docker run --rm -it \
15+
--env TERM \
16+
--env COLORTERM \
17+
python:latest \
18+
/bin/bash -c \
19+
"curl -fsSL https://juftin.com/dotfiles/get | bash && zsh"
20+
```
21+
22+
### Environment Variables
23+
24+
- `DOTFILES_REPO`: The repository to clone. Default: `juftin/dotfiles`
25+
- `DOTFILES_BRANCH`: The branch to check out. Default: `<default branch>`
26+
- `DOTFILES_DIR`: The directory to clone the repository into. Default: `~/.dotfiles`
27+
28+
## Manual Installation
29+
30+
If you prefer to install the dotfiles manually,
31+
instead of via the bootstrapping script, you can follow
32+
the steps below:
33+
34+
1. Install any missing dependencies
35+
36+
```shell
37+
apt install -y git curl zsh tar gh
38+
```
39+
40+
2. Clone the repo to `~/.dotfiles`
41+
42+
```shell
43+
git clone https://github.com/juftin/dotfiles.git ~/.dotfiles
44+
cd ~/.dotfiles
45+
```
46+
47+
3. Sync all git submodules
48+
49+
```shell
50+
git submodule update --init --recursive
51+
```
52+
53+
4. Link the dotfiles
54+
55+
```shell
56+
# ZSH
57+
ln -s ~/.dotfiles/bootstrap/oh-my-zsh ~/.oh-my-zsh
58+
ln -s ~/.dotfiles/bootstrap/powerlevel10k ~/.oh-my-zsh/custom/themes/powerlevel10k
59+
ln -s ~/.dotfiles/bootstrap/fast-syntax-highlighting ~/.oh-my-zsh/custom/plugins/fast-syntax-highlighting
60+
ln -s ~/.dotfiles/bootstrap/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
61+
ln -s ~/.dotfiles/bootstrap/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
62+
ln -s ~/.dotfiles/shell/.zshrc ~/.zshrc
63+
ln -s ~/.dotfiles/shell/.p10k.zsh ~/.p10k.zsh
64+
# BASH
65+
ln -s ~/.dotfiles/bootstrap/oh-my-bash ~/.oh-my-bash
66+
ln -s ~/.dotfiles/shell/.bashrc ~/.bashrc
67+
ln -s ~/.dotfiles/shell/.profile ~/.profile
68+
# SHELL
69+
ln -s ~/.dotfiles/shell/.shell_aliases ~/.shell_aliases
70+
ln -s ~/.dotfiles/shell/.mac_aliases ~/.mac_aliases
71+
# PYENV
72+
ln -s ~/.dotfiles/bootstrap/pyenv ~/.pyenv
73+
# GIT
74+
ln -s ~/.dotfiles/git/.gitconfig ~/.gitconfig
75+
ln -s ~/.dotfiles/git/.gitignore ~/.gitignore
76+
# BIN
77+
ls -s ~/.dotfiles/bin/aptfile /usr/local/bin/aptfile
78+
```

debian/Aptfile renamed to linux/Aptfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package "dialog"
1010
package "apt-utils"
1111
package "software-properties-common"
1212
package "build-essential"
13-
package "git-core"
13+
package "git"
1414
package "curl"
1515
package "wget"
1616

File renamed without changes.

mkdocs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ site_name: dotfiles
44
nav:
55
- Home 🏠: index.md
66
- Features ✨: features.md
7+
- Manual Installation 📦: manual_installation.md
78
theme:
89
favicon: https://juftin.com/favicon.ico
910
logo: https://raw.githubusercontent.com/juftin/juftin/main/static/juftin.png

shell/.shell_aliases

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,38 @@ function dotfiles-git() {
2525
}
2626

2727
function dotfiles-sync() {
28+
log_event "info" "Syncing dotfiles 🔄"
2829
dotfiles-git pull --recurse-submodules --jobs=4
30+
log_event "info" "Dotfiles synced successfully 🎉"
2931
}
3032

3133
function dotfiles-bootstrap() {
3234
bash "${DOTFILES_DIR}/bootstrap/bootstrap.sh"
3335
}
3436

37+
function dotfiles-deps() {
38+
OS_NAME=$(uname -s)
39+
if [[ ${OS_NAME} == "Darwin" ]]; then
40+
if ! command -v brew &>/dev/null; then
41+
echo "Error: Homebrew is not installed."
42+
return 1
43+
fi
44+
log_event "info" "Installing packages from Brewfile 📦"
45+
brew bundle --file="${DOTFILES_DIR}/macos/Brewfile"
46+
elif [[ ${OS_NAME} == "Linux" ]]; then
47+
if ! command -v apt &>/dev/null; then
48+
echo "Error: apt is not installed."
49+
return 1
50+
fi
51+
log_event "info" "Installing packages from Aptfile 📦"
52+
bash "${DOTFILES_DIR}/bin/aptfile" "${DOTFILES_DIR}/linux/Aptfile"
53+
else
54+
log_event "error" "Unsupported OS: ${OS_NAME}"
55+
return 1
56+
fi
57+
log_event "info" "Dependencies installed successfully 🎉"
58+
}
59+
3560
NO_COLOR='\033[0m'
3661
BLUE='\033[0;34m'
3762
GREEN='\033[0;32m'

0 commit comments

Comments
 (0)