Skip to content

Commit 4be9d6c

Browse files
committed
docs: update readme
1 parent 5ef84a0 commit 4be9d6c

1 file changed

Lines changed: 58 additions & 72 deletions

File tree

README.md

Lines changed: 58 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,90 @@
11
# Rootbeer
2+
23
> Manage your dotfiles with Lua!
34
45
Rootbeer is a dotfile manager that lets you define your system configuration
56
in Lua scripts. Think [chezmoi](https://www.chezmoi.io/), but with the full
6-
power of a real scripting language. Write declarative config tables, use
7-
conditionals based on your OS/hostname, and generate shell configs — all
8-
without learning a templating DSL.
7+
power of a real scripting language instead of Go templates.
8+
9+
**[Documentation →](https://rootbeer.dev)**
910

1011
## Quick Start
11-
```bash
12-
# Initialize with a new source directory
13-
rb init
1412

15-
# Or clone an existing dotfiles repo
16-
rb init tale/dotfiles
13+
Install and bootstrap in one command:
1714

18-
# Apply your configuration
19-
rb apply
15+
```bash
16+
# Clone an existing dotfiles repo
17+
sh -c "$(curl -fsSL rootbeer.tale.me/rb.sh)" -- init tale/dotfiles
2018

21-
# Dry run (preview without writing files)
22-
rb apply -n
19+
# Or start fresh
20+
sh -c "$(curl -fsSL rootbeer.tale.me/rb.sh)" -- init
2321
```
2422

25-
`rb init` creates a source directory at `~/.local/share/rootbeer/source/`
26-
with a starter `rootbeer.lua` manifest. When you run `rb apply`, it
27-
evaluates the manifest and writes/links your dotfiles into place.
23+
Then apply your configuration:
2824

29-
## Example Config
25+
```bash
26+
rb apply # apply configuration
27+
rb apply -n # dry run (preview without writing)
28+
rb apply personal # apply with a profile
29+
```
30+
31+
## What It Looks Like
3032

3133
```lua
32-
local rb = require("@rootbeer")
33-
local zsh = require("@rootbeer/shells/zsh")
34-
local d = rb.data()
35-
36-
-- Write a generated .zshrc
37-
rb.file("~/.zshrc", zsh.config({
38-
env = {
39-
EDITOR = "nvim",
40-
LANG = "en_US.UTF-8",
34+
local rb = require("rootbeer")
35+
local git = require("rootbeer.git")
36+
local zsh = require("rootbeer.zsh")
37+
local profile = require("rootbeer.profile")
38+
39+
git.config({
40+
user = {
41+
name = "Aarnav Tale",
42+
email = profile.select({
43+
default = "aarnav@personal.me",
44+
work = "aarnav@company.com",
45+
}),
4146
},
42-
aliases = {
43-
g = "git",
44-
v = "nvim",
45-
ls = "ls -la",
47+
editor = "nvim",
48+
signing = {
49+
key = "~/.ssh/id_ed25519.pub",
4650
},
47-
sources = { "~/.config/zsh/local.zsh" },
48-
extra = "autoload -Uz compinit && compinit",
49-
}))
50-
51-
-- Conditionals based on system data
52-
if d.os == "macos" then
53-
rb.file("~/.config/homebrew/env", 'export HOMEBREW_PREFIX="/opt/homebrew"\n')
51+
})
52+
53+
zsh.config({
54+
env = { EDITOR = "nvim" },
55+
aliases = { g = "git", vim = "nvim" },
56+
prompt = '%F{cyan}%~%f %F{white}>%f ',
57+
history = { size = 10000 },
58+
evals = { "mise activate zsh" },
59+
})
60+
61+
-- Conditionals — it's just Lua
62+
if rb.host.os == "macos" then
63+
local brew = require("rootbeer.brew")
64+
brew.config({
65+
taps = { "homebrew/cask-fonts" },
66+
formulae = { "lsd", "delta", "mise" },
67+
})
5468
end
55-
56-
-- Symlink a file from your source directory
57-
rb.link_file("config/gitconfig", "~/.gitconfig")
5869
```
5970

60-
## Lua API
61-
62-
### Core (`require("@rootbeer")`)
63-
64-
| Function | Description |
65-
|---|---|
66-
| `rb.file(path, content)` | Write `content` to `path` (`~` expands to `$HOME`) |
67-
| `rb.link_file(src, dest)` | Symlink `src` (relative to source dir) to `dest` |
68-
| `rb.data()` | Returns `{os, arch, hostname, home, username}` |
71+
## Key Ideas
6972

70-
### Shells (`require("@rootbeer/shells/zsh")`)
71-
72-
`zsh.config(table)` renders a declarative config table into a zshrc string.
73-
Supported keys: `env`, `aliases`, `evals`, `sources`, `extra`.
74-
75-
## How It Works
76-
77-
Rootbeer uses a **plan-first architecture**: your Lua script declares intent
78-
(write this file, create this symlink) without touching the filesystem.
79-
After the script completes, the plan is validated and executed — or in
80-
dry-run mode, just printed.
73+
- **Config is code** — Lua, not templates. Loops, conditionals, functions, and modules.
74+
- **Plan & apply**`rb.file()`, `rb.link_file()`, and module calls queue operations. Nothing touches the filesystem until `rb apply`.
75+
- **Declarative modules** — zsh, git, SSH, Homebrew, macOS, and more. Describe the end state as a table, rootbeer generates the files.
76+
- **Profiles** — Manage multiple machines from one repo with `profile.select`, `profile.when`, and `profile.config`.
77+
- **Editor support**`rb lsp` sets up lua-language-server for full autocomplete and type checking.
8178

8279
## Building
8380

8481
Requires Rust 1.79+.
8582

86-
### With Cargo
87-
88-
```bash
89-
cargo build
90-
```
91-
92-
Builds the binary to `./target/debug/rb`.
93-
94-
### With Nix
95-
9683
```bash
97-
nix build
84+
cargo build # → ./target/debug/rb
85+
nix build # → ./result/bin/rb
9886
```
9987

100-
Builds the binary to `./result/bin/rb`.
101-
10288
## License
10389

10490
MIT

0 commit comments

Comments
 (0)