diff --git a/AGENTS.md b/AGENTS.md index 9331e70..741a79a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,7 +9,7 @@ This is a personal dotfiles repository managed with [chezmoi](https://www.chezmo ### Installation Scripts - `./scripts/install-dotfiles.sh [--work-email ]` - Standard installation script; `--work-email` writes `~/work.email` before applying -- `./install.sh [--work-email ]` - Dev container / Linux bootstrap; `--work-email` writes `~/work.email` for non-interactive work setups +- `./install.sh [--work-email ]` - Dev container / Linux bootstrap (Debian/Ubuntu, Arch, Omarchy); `--work-email` writes `~/work.email` for non-interactive work setups ### Development Scripts @@ -19,9 +19,9 @@ This is a personal dotfiles repository managed with [chezmoi](https://www.chezmo Shell-agnostic commands applied by chezmoi to `~/.local/bin` (source: `root/dot_local/bin/`), so one bash implementation serves fish, bash, and zsh. Not applied on Windows (ignored via `.chezmoiignore.tmpl`): -- `update` - Updates everything: system packages (apt or pacman on Linux, brew on macOS), mise itself, chezmoi, then `chezmoi update` (pull latest dotfiles + apply), then `mise upgrade` for the freshly pulled tool pins, then each coding-agent CLI's own updater (`claude update`, `codex update`, `copilot update`, `agy update`, `opencode upgrade`) for whichever are installed — `install.sh` installs these with their vendor installers, not mise, so they can self-update; a failure is reported and skipped. The mise step is skipped over when mise is package-managed — the system-package step above already covered it -- `clean` - Prunes what `update` leaves behind: orphaned system packages and caches (`apt-get autoremove --purge`/`clean`, `pacman -Rns` of `-Qtdq` orphans + `-Sc`, `brew autoremove`/`cleanup --prune=all`), mise tool versions no longer referenced by any config (`mise prune`), and mise's download cache -- `bitwarden-ssh-sock` - Prints the SSH agent socket on machines where Bitwarden is the agent (see SSH Agent); `--forwarded` exits 0 only inside an SSH session with a forwarded agent. Applied only when `bitwardenSshAgent` is true +- `update` - Updates everything: system packages (apt or pacman on Linux, `omarchy update -y` on Omarchy, brew on macOS), mise itself, chezmoi, then `chezmoi update --init` (pull latest dotfiles, regenerate the config from `.chezmoi.toml.tmpl`, apply), then `mise upgrade` for the freshly pulled tool pins, then each coding-agent CLI's own updater (`claude update`, `codex update`, `copilot update`, `agy update`, `opencode upgrade`) for whichever are installed — `install.sh` installs these with their vendor installers, not mise, so they can self-update; a failure is reported and skipped. On Omarchy, a CLI that Omarchy's mise config provides is left to Omarchy (see Omarchy). The mise and chezmoi self-updates are skipped over when the binary is package-managed — the system-package step above already covered it +- `clean` - Prunes what `update` leaves behind: orphaned system packages and caches (`apt-get autoremove --purge`/`clean`, `pacman -Rns` of `-Qtdq` orphans + `-Sc`, `brew autoremove`/`cleanup --prune=all`), mise tool versions no longer referenced by any config (`mise prune`), and mise's download cache. On Omarchy the system-package step is skipped: `omarchy update` already removes orphans and prunes the cache down to two versions per package, its offline rollback path +- `bitwarden-ssh-sock` - Prints the SSH agent socket on machines where Bitwarden is the agent (see SSH Agent); `--forwarded` exits 0 only inside an SSH session with a forwarded agent. Applied only when `bitwardenSshAgent` is true (everywhere except dev containers, WSL and Windows) - `ssh-keygen-wsl` - git's `gpg.ssh.program` on WSL: runs Windows `ssh-keygen.exe`, the only `ssh-keygen` that can reach the Windows-side Bitwarden agent, after translating the absolute Linux paths git passes with `wslpath -w`. Applied only when `isWsl` is true - `set-work-email ` - Writes `~/work.email` and re-runs `chezmoi init --apply` so the work identity takes effect (Windows gets a PowerShell function equivalent in the profile) @@ -43,10 +43,11 @@ The dotfiles adapt based on environment variables: - `DOTFILES_SOURCE_DIR` - Override source directory (defaults to current directory for install.sh) - `DOTFILES_WORK_EMAIL` - Work email fallback when `~/work.email` is absent (the file wins; Codespaces user secrets surface as env vars) - `DOTFILES_WORK_EMAIL_FILE` - Relocates the work-email file from `~/work.email` (used by render.sh; unset in normal use) +- `ID=omarchy` in `/etc/os-release` - Sets `isOmarchy` (see Omarchy). Keyed on the distro ID, so it is false by construction on WSL, dev containers, macOS and Windows ### Identity System -The work identity is driven by a single file, **`~/work.email`**, whose only contents are one work email address (no other text or formatting). This mirrors the per-host signing-key file pattern (`~/.ssh/git_signing.pub`). When the file is absent, the **`DOTFILES_WORK_EMAIL`** env var is consulted as a fallback (the file always wins when both exist) — this is how Codespaces get a work identity, since user secrets surface there as env vars. `.chezmoi.toml.tmpl` reads the email at render time and derives the `identity`, `isWork`, `isPersonal`, and `workEmail` data variables. The email's **domain** selects the identity: +The work identity is driven by a single file, **`~/work.email`**, whose only contents are one work email address (no other text or formatting). When the file is absent, the **`DOTFILES_WORK_EMAIL`** env var is consulted as a fallback (the file always wins when both exist) — this is how Codespaces get a work identity, since user secrets surface there as env vars. `.chezmoi.toml.tmpl` reads the email at render time and derives the `identity`, `isWork`, `isPersonal`, and `workEmail` data variables. The email's **domain** selects the identity: | `~/work.email` | `identity` | `isWork` | `workEmail` | | --- | --- | --- | --- | @@ -70,19 +71,15 @@ There is no auto-detection or prompt: the file (or its env-var fallback) is the ### Git Signing -Commits are signed with an SSH key, resolved at `chezmoi init` time in `.chezmoi.toml.tmpl` (first match wins): - -1. **Bitwarden** - on `bitwardenSshAgent` machines (see SSH Agent), in dev containers, which use the host's forwarded Bitwarden agent, and on WSL, which uses the Windows-side Bitwarden agent through `ssh-keygen.exe` (see `ssh-keygen-wsl`), `signingkey` is the `key::` literal of the committed "GitHub Signing" public key, so git signs only through the Bitwarden agent. Any `~/.ssh/git_signing` on these machines is ignored. If Bitwarden isn't running or the prompt is denied, signing fails with an agent error rather than falling back to a file -2. **Key on disk** - a private key at `~/.ssh/git_signing`. `dot_gitconfig.tmpl` sets `signingkey` to the file path (`gitSigningKeyFile`) and git signs from disk with no agent. `gitSigningPubKey` is read from `~/.ssh/git_signing.pub` for `allowed_signers` -3. **Neither** - commits are not signed (`gitSign` is false); e.g. personal machines without a key file - -`signingKeyFileWanted` is true where no Bitwarden agent is available: not `bitwardenSshAgent`, not a dev container, and not WSL. After its first apply, `install.sh` checks it and, when no key exists yet, runs `scripts/generate-signing-key.sh` and re-runs `chezmoi init --apply` so the new key is picked up +Commits are always signed with the "GitHub Signing" key stored in Bitwarden. Its public key is inlined as `gitSigningPubKey` in `.chezmoi.toml.tmpl`, and `dot_gitconfig.tmpl` sets `signingkey` to its `key::` literal, so git signs only through an SSH agent holding that key: Bitwarden's own on `bitwardenSshAgent` machines (see SSH Agent), the host's forwarded Bitwarden agent in dev containers, and on WSL the Windows-side agent through `ssh-keygen.exe` (see `ssh-keygen-wsl`). There is no key-file fallback: if Bitwarden isn't running, isn't the agent, doesn't hold the key, or the prompt is denied, signing fails with an agent error. The `gitSign` data flag gates all signing config (`dot_gitconfig.tmpl`, `allowed_signers.tmpl`). It is always false in **Codespaces**, where GitHub signs commits server-side with its own web-flow key. ### SSH Agent -On work machines (`bitwardenSshAgent`: work identity, not a dev container, WSL or Windows) the Bitwarden desktop app is the only SSH agent. Dev containers keep the host's forwarded agent; on WSL the app runs on the Windows side, where its Unix socket is unreachable. Personal machines keep the platform agent (`fish_ssh_agent`, `IdentitiesOnly`). +`bitwardenSshAgent` is true everywhere except dev containers, WSL and Windows, and there the Bitwarden desktop app is the only SSH agent. A headless box reaches it through a forwarded agent (`ssh -A`, or VS Code Remote-SSH, which forwards by default). Without Bitwarden or a forwarded agent, ssh still authenticates with key files on disk (on macOS `UseKeychain` supplies their passphrases), but commits can't be signed (see Git Signing). Dev containers keep the host's forwarded agent. On WSL the app runs on the Windows side, where its Unix socket is unreachable, so fish starts a local agent shared across WSL shells (`fish_ssh_agent`) and ssh keeps `AddKeysToAgent`/`IdentitiesOnly`. + +A forwarded agent only lives as long as the SSH session: a coding agent left committing in a zellij or tmux session after you disconnect can't reach it, nor after you reconnect, since the session keeps the old socket path. Give such a box its own choice in `~/.config/local/gitconfig` (see Local Overrides): a box-only signing key (`[user] signingkey = ~/.ssh/git_signing`, added to GitHub as a signing key) or no signing (`[commit] gpgSign = false` and `[tag] gpgSign = false`). Sandboxed installs put the socket inside their container, so `.chezmoi.toml.tmpl` renders an ordered per-OS candidate list, `bitwardenSshSocks` (macOS App Store; Linux snap, flatpak), always ending with the native install path `~/.bitwarden-ssh-agent.sock` as the fallback. The first socket that exists at runtime wins, and a forwarded agent in an SSH session (a work VM reached with `ssh -A`) wins over all of them. The same order is applied by two consumers: @@ -93,7 +90,9 @@ Bitwarden leaves its socket file on disk after quitting, so the check stays stab ### Tool Management -CLI tools are managed by [mise](https://mise.jdx.dev/) via `root/private_dot_config/mise/config.toml.tmpl`. Language SDKs (go, node, bun) are conditionally included only outside dev containers (`not .isDc`). Tools are installed automatically during `chezmoi apply` via the `run_onchange_after_01-mise-install.sh.tmpl` script. +CLI tools are managed by [mise](https://mise.jdx.dev/) via `root/private_dot_config/mise/conf.d/10-dotfiles.toml.tmpl`, applied as a `conf.d` drop-in. Language SDKs (go, node, bun) are conditionally included only outside dev containers (`not .isDc`). On Omarchy, tools Omarchy installs as system packages (starship, lazygit, fd, fzf, jq, ripgrep, zoxide, usage, herdr) are left out. Tools are installed automatically during `chezmoi apply` via the `run_onchange_after_01-mise-install.sh.tmpl` script. + +`~/.config/mise/config.toml` is deliberately not managed: it belongs to `mise use -g`, whether you run it or Omarchy's agent wrappers fall back to it, so a managed copy would be reverted and rewritten on every apply. A tool pinned there outranks the drop-in's pin. `modify_config.toml` only removes a `config.toml` that an older version of the dotfiles wrote (recognized by its top-level `minimum_release_age`/`idiomatic_version_file_enable_tools` settings, which `mise use -g` never writes); anything else passes through untouched. ### Chezmoi Automation Scripts @@ -102,10 +101,12 @@ Post-install scripts in `root/.chezmoiscripts/` run automatically during `chezmo - `run_onchange_after_01-mise-install.sh.tmpl` - Installs mise tools when config changes - `run_after_mise-update.sh.tmpl` / `.ps1.tmpl` - Runs `mise self-update`. Failure is reported and stepped over rather than aborting the apply: packagers can disable self-update so mise is updated through the package manager instead (Homebrew, Arch's `mise`, distro and scoop/winget packages), and those builds exit nonzero — as does a root-owned mise an unprivileged user can't replace. Updating mise there belongs to whatever installed it - `run_after_install-claude-config.sh.tmpl` - Syncs Claude Code configuration -- `run_onchange_after_02-install-completions.sh.tmpl` - Generates fish completions for every installed tool that supports it (gh, docker, mise, rg, fd, ast-grep, zellij, herdr, starship, pnpm); re-runs when the mise config changes so completions track tool versions. worktrunk uses dynamic completions instead (`conf.d/wt.fish` sources `COMPLETE=fish wt` at shell startup) +- `run_onchange_after_02-install-completions.sh.tmpl` - Generates fish completions for every installed tool that supports it (gh, docker, mise, rg, fd, ast-grep, zellij, herdr, starship, pnpm); re-runs when the mise config changes so completions track tool versions. worktrunk uses dynamic completions instead (`conf.d/wt.fish` sources `COMPLETE=fish wt` at shell startup). Not on Omarchy, where fish isn't used - `run_onchange_after_04-claude-plugins.sh.tmpl` - Installs/enables Claude Code plugins when the plugin list changes (see Claude Plugin Management) -- `run_onchange_after_05-bitwarden-ssh-agent.sh.tmpl` - macOS work machines: (re)loads the Bitwarden `SSH_AUTH_SOCK` LaunchAgent when it changes, so GUI apps pick it up without a re-login (see SSH Agent) +- `run_onchange_after_05-bitwarden-ssh-agent.sh.tmpl` - macOS: (re)loads the Bitwarden `SSH_AUTH_SOCK` LaunchAgent when it changes, so GUI apps pick it up without a re-login (see SSH Agent) - `run_onchange_after_06-codex-plugins.sh.tmpl` - Installs Codex plugins when the plugin list changes (see Codex Plugin Management) +- `run_onchange_after_07-omarchy-theme.sh.tmpl` - Omarchy: runs `omarchy theme refresh` when a managed theme's `colors.toml` changes and that theme is the active one (see Omarchy) +- `run_after_08-omarchy-packages.sh.tmpl` - Omarchy: installs whatever `.chezmoidata/omarchy.toml` lists that is missing (see Omarchy) ### Claude Plugin Management @@ -184,6 +185,34 @@ to it), so **removing** an entry from `codex.toml` does not uninstall it; also r Rules are checked top to bottom and the first match wins, so native apps come first. To add a domain, add it to the relevant rule's `host` list (a host also matches its subdomains). +### Omarchy + +On [Omarchy](https://omarchy.org/) (`isOmarchy`), the dotfiles layer on top of Omarchy rather than replace it, and install and update through its own entrypoints. Omarchy's defaults live read-only in `/usr/share/omarchy`; read them before changing anything here. + +- **Who owns what** - Omarchy themes and migrates the ghostty, starship and herdr configs, so `.chezmoiignore.tmpl` leaves them (and the unused fish config) to it there. In `~/.config/hypr`, only `input.lua` and `looknfeel.lua` are managed, and they hold just the overrides on top of Omarchy's defaults. Omarchy's migrations rewrite a user file only while it still matches a stock version, so a managed file that differs is never contested, while a managed stock file would be. `monitors.lua`, `bindings.lua`, `autostart.lua` and `~/.config/omarchy/shell.json` stay per-machine. Only manage a file that differs from its `$OMARCHY_PATH/config` default +- **Shell** - bash, Omarchy's shell; `install.sh` installs neither fish nor changes the login shell. `.bashrc` keeps Omarchy's own structure (env-bootstrap above the interactivity guard, then `$OMARCHY_PATH/default/bash/rc`, which sets up the prompt, mise, zoxide, fzf and history) and adds only what is ours below it +- **Git** - `.chezmoiremove.tmpl` removes Omarchy's `~/.config/git/config`: git reads it beneath `~/.gitconfig`, so its `init.defaultBranch = master` and personal email would leak through on keys we leave unset. Its useful defaults are carried in `dot_gitconfig.tmpl` +- **Packages** - `.chezmoidata/omarchy.toml` lists repo packages (`omarchy pkg add`), AUR packages (`omarchy pkg aur add`), Omarchy installers (`omarchy install `, preferred whenever one exists because they also wire the app into Omarchy; each has a sentinel package that decides whether it still needs to run) and third-party shell plugins (`omarchy plugin add`, installed but never enabled, since `shell.json` is per-machine). `run_after_08-omarchy-packages.sh.tmpl` runs on every apply but does nothing once everything is present; failures only warn, and without a terminal for sudo it says what it skipped. Removing an entry never uninstalls anything +- **Themes** - custom theme definitions live in `private_dot_config/omarchy/themes//` (`colors.toml`, `backgrounds/`) and appear in Omarchy's theme switcher; nothing here selects the active theme. Claude Code's settings use `"theme": "custom:omarchy"`, the theme file Omarchy regenerates on every theme change +- **Updates** - `update` runs `omarchy update -y` (Omarchy blocks a direct `pacman -Syu` with a libalpm hook), and `install.sh` installs with `omarchy pkg add` and takes chezmoi from the Arch repos. Omarchy's mise config (`/etc/mise/conf.d/omarchy-tools.toml`) provides most coding-agent CLIs lazily, so `install.sh` and `update` skip their vendor installers/updaters for any CLI it declares (`omarchy-mise-default-tools declares `), unless the user opted out of Omarchy's default tools + +### Shell Abbreviations + +`root/.chezmoidata/shell.toml` holds one list of command abbreviations for every shell. fish renders it as abbreviations (`conf.d/abbreviations.fish.tmpl`); bash and zsh render it as aliases (the `shell-abbreviations` partial). Add one with a line in that file. fish-only aliases (`ls` → lsd and friends) stay in `conf.d/alias.fish`. + +### Local Overrides + +`~/.config/local/` holds per-machine overrides that the dotfiles never manage. Each managed config loads its file there only if it exists, last, so it wins: + +| File | Loaded by | +| --- | --- | +| `shell.sh` | `.bashrc`, `.zshrc` | +| `shell.fish` | `config.fish` | +| `gitconfig` | `.gitconfig` (`[include]`) | +| `hypr.lua` | `~/.config/hypr/looknfeel.lua` (Omarchy; re-read on `hyprctl reload`) | + +To add another, have the managed config load `~/.config/local/` when it exists. + ### Environment Variables Simple key-value environment variables (e.g., `VISUAL`, `HOMEBREW_NO_AUTO_UPDATE`) are centralized in template partials under `root/.chezmoitemplates/`. Each partial renders the same variables in the syntax for its target shell: @@ -212,9 +241,13 @@ On Windows, `run_onchange_after_03-windows-env.ps1.tmpl` persists env vars from - `root/dot_gitconfig.tmpl` - Git configuration with conditional work includes - `root/dot_gitconfig-work.tmpl` - Work-specific git configuration - `root/private_dot_config/fish/config.fish.tmpl` - Fish shell configuration -- `root/dot_bashrc.tmpl` - Bash configuration (Homebrew, starship, mise, zoxide, mcfly) +- `root/dot_bashrc.tmpl` - Bash configuration (Homebrew, starship, mise, zoxide, mcfly; on Omarchy, layered on Omarchy's rc) - `root/dot_zshrc.tmpl` - Zsh configuration - `root/private_dot_config/brouter/config.toml.tmpl` - Brouter link-routing rules (macOS) +- `root/private_dot_config/mise/conf.d/10-dotfiles.toml.tmpl` - mise tool pins and settings +- `root/.chezmoidata/shell.toml` - Shell abbreviations for every shell +- `root/.chezmoidata/omarchy.toml` - Omarchy packages, installers and shell plugins +- `root/private_dot_config/hypr/` - Hyprland overrides (Omarchy) ## Common Commands diff --git a/README.md b/README.md index 9c7ee29..3f62921 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,13 @@ My personal dotfiles, managed with [chezmoi](https://www.chezmoi.io/). ## Install -### Linux (Debian/Ubuntu/Arch) — dev containers, WSL, cloud VMs +### Linux (Debian/Ubuntu/Arch/Omarchy) — dev containers, WSL, cloud VMs Clone and run the bootstrap script. It installs mise, chezmoi, fish, Claude Code, Codex, Antigravity CLI, GitHub Copilot CLI, and opencode, then applies the -dotfiles: +dotfiles. On [Omarchy](https://omarchy.org/) it installs through Omarchy's own +commands instead, keeps bash as the shell, and leaves the coding-agent CLIs that +Omarchy already provides to Omarchy: ```sh git clone https://github.com/CS-5/dotfiles.git ~/.local/share/chezmoi @@ -43,16 +45,17 @@ iex "&{$(irm 'https://get.chezmoi.io/ps1')} init --apply CS-5" ## Commit signing -Commits are signed with an SSH key, picked at `chezmoi init` time: +Commits are signed with the "GitHub Signing" SSH key stored in Bitwarden, whose +public key is inlined in the git config. git signs only through an SSH agent +that holds it: Bitwarden's own, the host's agent forwarded into a dev container, +or the Windows-side Bitwarden agent on WSL. Nothing is kept on disk; Bitwarden +must be running and unlocked to commit, and without it commits fail. -1. On work machines where Bitwarden is the SSH agent, and in dev containers - (which use the host's forwarded agent), git signs through Bitwarden with the - "GitHub Signing" key stored in the vault. Nothing is kept on disk; Bitwarden - must be running and unlocked to commit. -2. Otherwise, if `~/.ssh/git_signing` exists, git signs directly from that file - (no agent needed). `install.sh` generates one on Linux hosts without a - Bitwarden agent, except WSL. -3. Otherwise, commits are not signed. +On a headless box, connect with agent forwarding (`ssh -A`, or VS Code +Remote-SSH) so it signs through Bitwarden on the machine you connect from. A +box that commits while nobody is connected (e.g. a coding agent in a zellij +session) needs its own choice in `~/.config/local/gitconfig`: a signing key +just for that box, or `gpgSign = false` under `[commit]` and `[tag]`. Signing is always disabled in Codespaces (GitHub signs those server-side). @@ -62,3 +65,9 @@ On macOS, the dotfiles configure [Brouter](https://github.com/CS-5/Brouter) at `~/.config/brouter/config.toml`. Install the app yourself from its [releases](https://github.com/CS-5/Brouter/releases) and let it become the default browser. The routing rules are described in `AGENTS.md`. + +## Per-machine overrides + +Anything that should apply to one machine only goes in `~/.config/local/`, +which the dotfiles never touch: `shell.sh` (bash/zsh), `shell.fish`, +`gitconfig`, and `hypr.lua` (Omarchy). Each is loaded last, if it exists. diff --git a/install.sh b/install.sh index f882e44..d7b15c1 100755 --- a/install.sh +++ b/install.sh @@ -32,6 +32,20 @@ SCRIPT_DIR="$DOTFILES_SOURCE_DIR/scripts" source "$SCRIPT_DIR/lib.sh" +# Omarchy installs and updates packages through its own entrypoints (a libalpm +# hook aborts a direct `pacman -Syu`) and keeps bash as the shell. +IS_OMARCHY=false +if [[ -r /etc/os-release ]] && grep -qx 'ID=omarchy' /etc/os-release; then + IS_OMARCHY=true +fi + +# Omarchy's mise config provides most coding-agent CLIs itself (and keeps them +# current), unless this user opted out of Omarchy's default tools. +omarchy_provides() { + [[ "$IS_OMARCHY" == "true" ]] && command -v omarchy-mise-default-tools >/dev/null 2>&1 && + omarchy-mise-default-tools declares "$1" +} + while [[ $# -gt 0 ]]; do case $1 in --work-email) @@ -51,7 +65,10 @@ while [[ $# -gt 0 ]]; do esac done -mkdir -p ~/.local/bin ~/.config/fish/{conf.d,completions} +mkdir -p ~/.local/bin +if [[ "$IS_OMARCHY" != "true" ]]; then + mkdir -p ~/.config/fish/{conf.d,completions} +fi log_info "Setting up environment${WORK_EMAIL:+ (work email: $WORK_EMAIL)}" @@ -61,7 +78,12 @@ export PATH="$HOME/.local/bin:$PATH" show_progress "Installing bootstrap dependencies" # Same package names in Debian/Ubuntu and Arch repos. BOOTSTRAP_PKGS=(curl git wget unzip gnupg fish neovim) -if command -v apt-get >/dev/null 2>&1; then +if [[ "$IS_OMARCHY" == "true" ]]; then + # No fish (bash is the shell here). chezmoi comes from the Arch repos rather + # than its curl installer, so `omarchy update` keeps it current. + # `omarchy pkg add` installs only what is missing, without a -Syu. + omarchy pkg add curl git wget unzip gnupg neovim chezmoi +elif command -v apt-get >/dev/null 2>&1; then sudo apt-get update sudo apt-get install -y "${BOOTSTRAP_PKGS[@]}" elif command -v pacman >/dev/null 2>&1; then @@ -101,54 +123,70 @@ else fi log_success "Dotfiles installed and applied" -#### Signing Key #### -# The rendered chezmoi config decides whether this host signs from a key file -# (no Bitwarden agent, not a dev container or WSL), so this runs after init. -# A newly generated key is only detected at render time, hence the re-init. -if [[ "$(chezmoi execute-template '{{ .signingKeyFileWanted }}')" == "true" && ! -f "$HOME/.ssh/git_signing" ]]; then - show_progress "Generating commit signing key" - "$SCRIPT_DIR/generate-signing-key.sh" - chezmoi init --apply --error-on-conflict --source="$DOTFILES_SOURCE_DIR" - log_success "Signing key generated and applied" -fi - #### Shell #### -show_progress "Setting up shell" -fish -c "fundle install" -if [[ "${SHELL:-}" != *"fish"* ]]; then - log_info "Changing default shell to fish" - sudo chsh -s "$(which fish)" "${USER:-$(id -un)}" +# Omarchy keeps bash: its own ~/.bashrc layering is what the dotfiles extend. +if [[ "$IS_OMARCHY" != "true" ]]; then + show_progress "Setting up shell" + fish -c "fundle install" + if [[ "${SHELL:-}" != *"fish"* ]]; then + log_info "Changing default shell to fish" + sudo chsh -s "$(which fish)" "${USER:-$(id -un)}" + fi + log_success "Shell setup complete" fi -log_success "Shell setup complete" + +#### Coding-agent CLIs #### +# Each with its vendor's installer, so it can self-update (see `update`), +# except where Omarchy's mise config already provides it. #### Claude Code #### -show_progress "Installing Claude Code" -curl -fsSL https://claude.ai/install.sh | bash -log_success "Claude Code installed" +if omarchy_provides claude; then + log_info "Claude Code is provided by Omarchy" +else + show_progress "Installing Claude Code" + curl -fsSL https://claude.ai/install.sh | bash + log_success "Claude Code installed" +fi #### Codex #### # CODEX_NON_INTERACTIVE: the installer otherwise offers to launch codex via # /dev/tty, which would stall an unattended bootstrap. -show_progress "Installing Codex" -curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh -log_success "Codex installed" +if omarchy_provides codex; then + log_info "Codex is provided by Omarchy" +else + show_progress "Installing Codex" + curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh + log_success "Codex installed" +fi #### Antigravity CLI #### -show_progress "Installing Antigravity CLI" -curl -fsSL https://antigravity.google/cli/install.sh | bash -log_success "Antigravity CLI installed" +if omarchy_provides antigravity-cli; then + log_info "Antigravity CLI is provided by Omarchy" +else + show_progress "Installing Antigravity CLI" + curl -fsSL https://antigravity.google/cli/install.sh | bash + log_success "Antigravity CLI installed" +fi #### GitHub Copilot CLI #### # PREFIX pins ~/.local/bin; the installer would pick /usr/local when run as root. -show_progress "Installing GitHub Copilot CLI" -curl -fsSL https://gh.io/copilot-install | PREFIX="$HOME/.local" bash -log_success "GitHub Copilot CLI installed" +if omarchy_provides copilot; then + log_info "GitHub Copilot CLI is provided by Omarchy" +else + show_progress "Installing GitHub Copilot CLI" + curl -fsSL https://gh.io/copilot-install | PREFIX="$HOME/.local" bash + log_success "GitHub Copilot CLI installed" +fi #### opencode #### # --no-modify-path: the installer would otherwise append to chezmoi-managed # shell configs, which already put ~/.opencode/bin on PATH. -show_progress "Installing opencode" -curl -fsSL https://opencode.ai/v2/install | bash -s -- --no-modify-path -log_success "opencode installed" +if omarchy_provides opencode; then + log_info "opencode is provided by Omarchy" +else + show_progress "Installing opencode" + curl -fsSL https://opencode.ai/v2/install | bash -s -- --no-modify-path + log_success "opencode installed" +fi log_success "Setup complete" diff --git a/render.sh b/render.sh index bd7a32c..6be9b7d 100755 --- a/render.sh +++ b/render.sh @@ -10,8 +10,7 @@ # home, this script points the file check at a nonexistent temp path (via # DOTFILES_WORK_EMAIL_FILE) and supplies the email through the env var, so # the template's real detection logic (env fallback + domain mapping) runs -# (HOME is left intact, so signing-key and other homeDir-derived paths stay -# faithful to the host). +# (HOME is left intact, so homeDir-derived paths stay faithful to the host). # # Usage: ./render.sh [--identity IDENTITY] [--work-email ] [--dc] [--codespaces] [--data ] diff --git a/root/.chezmoi.toml.tmpl b/root/.chezmoi.toml.tmpl index 3711fb3..2f687ce 100644 --- a/root/.chezmoi.toml.tmpl +++ b/root/.chezmoi.toml.tmpl @@ -3,14 +3,17 @@ sourceDir = {{ env "DOTFILES_SOURCE_DIR" | default "~/.local/share/chezmoi" | qu {{ $probablyDc := or (env "REMOTE_CONTAINERS_IPC" | not | not) (eq (env "USER") "vscode") (stat "/workspaces" | not | not) -}} {{ $isCodespaces := env "CODESPACES" | not | not -}} {{ $isDc := or $probablyDc $isCodespaces -}} +{{/* Keyed on the distro ID rather than a path, so it is false by + construction on WSL (ID=arch/ubuntu), dev containers, macOS and Windows. */}} +{{ $isOmarchy := eq (dig "osRelease" "id" "" .chezmoi) "omarchy" -}} {{ $binDir := ".local/bin" -}} {{/* Work identity is driven by ~/work.email: a file whose sole contents are one work email address. When the file is absent, the DOTFILES_WORK_EMAIL env var is consulted as a fallback (Codespaces user secrets surface as env vars). The email's domain selects the - identity; no email or an unrecognized domain means personal. Mirrors - the per-host signing-key file below. Add new jobs to $identities. */}} + identity; no email or an unrecognized domain means personal. Add new + jobs to $identities. */}} {{ $identities := dict "kirbtech.com" "kirbtech" "journalytic.com" "journalytic" -}} @@ -34,14 +37,15 @@ sourceDir = {{ env "DOTFILES_SOURCE_DIR" | default "~/.local/share/chezmoi" | qu {{ end -}} {{ $isWork := ne $identity "personal" -}} -{{/* Work machines use the Bitwarden desktop app as their only SSH agent. - Dev containers use the host's forwarded agent instead, and on WSL the - app runs on the Windows side where its Unix socket is unreachable. - Sandboxed installs (App Store, snap, flatpak) put the socket inside - their container, so candidates are checked in order at runtime; the - last entry, the native install path, is the fallback. */}} +{{/* The Bitwarden desktop app is the only SSH agent, reached directly or + forwarded into an SSH session (ssh -A), which is how a headless box + reaches it. Dev containers use the host's forwarded agent instead, and + on WSL the app runs on the Windows side where its Unix socket is + unreachable. Sandboxed + installs (App Store, snap, flatpak) put the socket inside their + container, so candidates are checked in order at runtime; the last + entry, the native install path, is the fallback. */}} {{ $isWsl := env "WSL_DISTRO_NAME" | not | not -}} -{{ $bitwardenSshAgent := and $isWork (not $isDc) (not $isWsl) (ne .chezmoi.os "windows") -}} {{ $bitwardenSshSocks := list -}} {{ if eq .chezmoi.os "darwin" -}} {{ $bitwardenSshSocks = append $bitwardenSshSocks (joinPath .chezmoi.homeDir "Library/Containers/com.bitwarden.desktop/Data/.bitwarden-ssh-agent.sock") -}} @@ -50,30 +54,14 @@ sourceDir = {{ env "DOTFILES_SOURCE_DIR" | default "~/.local/share/chezmoi" | qu {{ $bitwardenSshSocks = append $bitwardenSshSocks (joinPath .chezmoi.homeDir ".var/app/com.bitwarden.desktop/data/.bitwarden-ssh-agent.sock") -}} {{ end -}} {{ $bitwardenSshSocks = append $bitwardenSshSocks (joinPath .chezmoi.homeDir ".bitwarden-ssh-agent.sock") -}} +{{ $bitwardenSshAgent := and (not $isDc) (not $isWsl) (ne .chezmoi.os "windows") -}} -{{/* Signing key, first match wins: - 1. Bitwarden as the SSH agent, directly, forwarded into a dev container - from the host, or on the Windows side of WSL (reached through - ssh-keygen.exe): git signs through the agent with the "GitHub - Signing" key stored in the vault, so nothing lives on disk. - Any ~/.ssh/git_signing on these machines is ignored. - 2. A private key on disk at ~/.ssh/git_signing: git signs from the - file, no agent. install.sh generates one where $signingKeyFileWanted. - 3. Neither: commits are not signed. */}} -{{ $signingKey := "" -}} -{{ $signingKeyFile := "" -}} -{{ $signingKeyFilePath := joinPath .chezmoi.homeDir ".ssh/git_signing" -}} -{{ $signingKeyFileWanted := not (or $bitwardenSshAgent $isDc $isWsl) -}} -{{ if or $bitwardenSshAgent $isDc $isWsl -}} - {{ $signingKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGUhU31PFPWI9ggTCNK7JuYnc7O7RrUKgjjt2aWDCVIP" -}} -{{ else if stat $signingKeyFilePath -}} - {{ $signingKeyFile = $signingKeyFilePath -}} - {{ $signingPubKeyPath := printf "%s.pub" $signingKeyFilePath -}} - {{ if stat $signingPubKeyPath -}}{{ $signingKey = include $signingPubKeyPath | trim -}}{{ end -}} -{{ end -}} - -{{/* Codespaces sign server-side with GitHub's own web-flow key. */}} -{{ $gitSign := and (not $isCodespaces) (or (ne $signingKeyFile "") (ne $signingKey "")) -}} +{{/* Commits are signed with the "GitHub Signing" key stored in Bitwarden, + always through an SSH agent: Bitwarden's own, the host's forwarded into + a dev container, or the Windows-side one on WSL (reached through + ssh-keygen.exe). Codespaces sign server-side with GitHub's own + web-flow key. */}} +{{ $gitSign := not $isCodespaces -}} [data] # Environment Info @@ -85,6 +73,7 @@ sourceDir = {{ env "DOTFILES_SOURCE_DIR" | default "~/.local/share/chezmoi" | qu isWindows = {{ eq .chezmoi.os "windows" }} isWsl = {{ $isWsl }} isDc = {{ $isDc }} + isOmarchy = {{ $isOmarchy }} # Identity identity = {{ $identity | quote }} @@ -96,10 +85,8 @@ sourceDir = {{ env "DOTFILES_SOURCE_DIR" | default "~/.local/share/chezmoi" | qu workEmail = {{ $workEmail | quote }} # Signing - gitSigningPubKey = {{ $signingKey | quote }} - gitSigningKeyFile = {{ $signingKeyFile | quote }} + gitSigningPubKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGUhU31PFPWI9ggTCNK7JuYnc7O7RrUKgjjt2aWDCVIP" gitSign = {{ $gitSign }} - signingKeyFileWanted = {{ $signingKeyFileWanted }} # SSH agent bitwardenSshAgent = {{ $bitwardenSshAgent }} diff --git a/root/.chezmoidata/omarchy.toml b/root/.chezmoidata/omarchy.toml new file mode 100644 index 0000000..566d4ad --- /dev/null +++ b/root/.chezmoidata/omarchy.toml @@ -0,0 +1,63 @@ +# What an Omarchy machine needs that isn't a file: packages, Omarchy's own +# installers, and third-party shell plugins. Source-only (under .chezmoidata/ +# this is template data, never a file in $HOME), consumed by +# .chezmoiscripts/run_after_08-omarchy-packages.sh.tmpl. +# +# To add something, add an entry. This says what must be present, not what +# must be absent: deleting an entry never uninstalls anything. + +[omarchy] + +# Arch and Omarchy repo packages, installed with `omarchy pkg add`. +packages = ["bitwarden", "efibootmgr", "fwupd", "usbutils"] + +# AUR packages, installed with `omarchy pkg aur add`. +aur = ["hyprmoncfg"] + +# Omarchy's installers do more than install a package (set the app as the +# Omarchy default, wire it into the theme system, ...), so they are preferred +# whenever one exists. `package` is the sentinel: the installer runs only while +# that package is missing. +[[omarchy.installers]] +command = "terminal ghostty" +package = "ghostty" + +[[omarchy.installers]] +command = "editor vscode" +package = "visual-studio-code-bin" + +[[omarchy.installers]] +command = "editor zed" +package = "zed" + +[[omarchy.installers]] +command = "browser chrome" +package = "google-chrome" + +[[omarchy.installers]] +command = "ai claude" +package = "claude-desktop" + +# Third-party Omarchy shell plugins, cloned into ~/.config/omarchy/plugins. +# Only installed, never enabled: shell.json is yours, so place each one once +# per machine with `omarchy plugin enable `. `omarchy plugin update` keeps +# them current. +[[omarchy.plugins]] +id = "bobbynicholas.omaland" +url = "https://github.com/bobby-nicholas/omaland.git" + +[[omarchy.plugins]] +id = "crmne.hyprmoncfg" +url = "https://github.com/crmne/omarchy-hyprmoncfg.git" + +[[omarchy.plugins]] +id = "io.github.sirjul1337.lock-explorer" +url = "https://github.com/SirJul1337/omarchy-lock-explorer.git" + +[[omarchy.plugins]] +id = "jkoestinger.vpn" +url = "https://github.com/jkoestinger/omarchy-vpn.git" + +[[omarchy.plugins]] +id = "io.github.cyprusad.omakeez" +url = "https://github.com/cyprusad/omakeez.git" diff --git a/root/.chezmoidata/shell.toml b/root/.chezmoidata/shell.toml new file mode 100644 index 0000000..1cb1fa3 --- /dev/null +++ b/root/.chezmoidata/shell.toml @@ -0,0 +1,42 @@ +# Command abbreviations for every shell, kept in this one list. fish renders +# them as abbreviations (expanded as you type, via conf.d/abbreviations.fish); +# bash and zsh render them as aliases (via the shell-abbreviations partial). +# Source-only: under .chezmoidata/ this is template data, never a file in $HOME. +# +# To add one, add a line. Expansions are rendered inside single quotes, so they +# must not contain a single quote themselves. + +[shell.abbreviations] +# git +g = "git" +gs = "git status -sb" +ga = "git add" +gc = "git commit" +gcm = "git commit -m" +gca = "git commit --amend" +gcl = "git clone" +gco = "git checkout" +gp = "git push" +gpf = "git push --force-with-lease" +gpl = "git pull" +gl = "git l" +gd = "git diff" +gds = "git diff --staged" +gf = "git fetch" + +# chezmoi +cma = "chezmoi apply" +cmu = "chezmoi update" +cmcd = "chezmoi cd" + +# mise +mls = "mise ls" +mi = "mise install" +mup = "mise upgrade" +mus = "mise use" + +# Claude Code +cc = "claude" +ccr = "claude --resume" +ccc = "claude --continue" +ccp = "claude -p" diff --git a/root/.chezmoiignore.tmpl b/root/.chezmoiignore.tmpl index c53a034..57a1faf 100644 --- a/root/.chezmoiignore.tmpl +++ b/root/.chezmoiignore.tmpl @@ -35,3 +35,16 @@ Library {{- end }} {{ end -}} + +{{- /* Desktop config for Omarchy (Hyprland + the Omarchy shell). On Omarchy, + Omarchy owns the terminal, prompt and multiplexer configs (it themes + them and its migrations keep them current), and bash is the shell. */}} +{{- if .isOmarchy }} +.config/ghostty +.config/starship.toml +.config/herdr +.config/fish +{{- else }} +.config/hypr +.config/omarchy +{{- end }} diff --git a/root/.chezmoiremove.tmpl b/root/.chezmoiremove.tmpl index e69de29..c55633b 100644 --- a/root/.chezmoiremove.tmpl +++ b/root/.chezmoiremove.tmpl @@ -0,0 +1,12 @@ +{{- if .isOmarchy }} +{{- /* Omarchy's installer writes ~/.config/git/config (a personal user.email and + init.defaultBranch=master among its defaults). git reads it beneath + ~/.gitconfig, so every key the dotfiles leave unset would leak through + from it. Its useful defaults live in dot_gitconfig.tmpl instead. Only + `omarchy refresh config git/config` or a config reinstall recreates it, + and the next apply removes it again. */}} +.config/git/config +{{- end }} +{{- /* Replaced by conf.d/abbreviations.fish. chezmoi leaves a target in place + when its source is deleted, so a retired file is listed here. */}} +.config/fish/conf.d/claude.fish diff --git a/root/.chezmoiscripts/run_after_08-omarchy-packages.sh.tmpl b/root/.chezmoiscripts/run_after_08-omarchy-packages.sh.tmpl new file mode 100644 index 0000000..d7e8b27 --- /dev/null +++ b/root/.chezmoiscripts/run_after_08-omarchy-packages.sh.tmpl @@ -0,0 +1,67 @@ +{{ if .isOmarchy -}} +#!/bin/bash + +# Install whatever .chezmoidata/omarchy.toml lists that isn't here yet. +# +# A plain run_ script rather than run_onchange_, on purpose: every step is +# guarded by a presence check, so on a settled machine this is a handful of +# `pacman -Q` calls that print nothing. A run_onchange_ would record itself as +# done even after a run that had to skip work (no terminal for sudo, network +# down) and never retry. Failures only warn, so they never block the apply; +# the next apply picks up whatever is still missing. + +set -uo pipefail + +warn() { printf 'omarchy-packages: %s\n' "$1" >&2; } + +packages=({{ range .omarchy.packages }}{{ . | quote }} {{ end }}) +aur=({{ range .omarchy.aur }}{{ . | quote }} {{ end }}) + +missing=() +for pkg in "${packages[@]}"; do + pacman -Q "$pkg" &>/dev/null || missing+=("$pkg") +done + +missing_aur=() +for pkg in "${aur[@]}"; do + pacman -Q "$pkg" &>/dev/null || missing_aur+=("$pkg") +done + +installers=() +{{ range .omarchy.installers -}} +pacman -Q {{ .package | quote }} &>/dev/null || installers+=({{ .command | quote }}) +{{ end }} +# Plugins are git clones into ~/.config/omarchy/plugins and need no root. +{{ range .omarchy.plugins -}} +if [[ ! -d "$HOME/.config/omarchy/plugins/"{{ .id | quote }} ]]; then + omarchy plugin add {{ .url | quote }} --yes || warn "could not add plugin {{ .id }}" +fi +{{ end }} +((${#missing[@]} + ${#missing_aur[@]} + ${#installers[@]})) || exit 0 + +# Everything below needs sudo, and there is nowhere to type a password without +# a terminal (an apply from a script or a bar widget). Say what was skipped. +if [[ ! -t 0 ]]; then + warn "no terminal for sudo, skipping: ${missing[*]} ${missing_aur[*]} ${installers[*]}" + warn "run 'chezmoi apply' from a terminal to finish" + exit 0 +fi + +if ((${#missing[@]})); then + omarchy pkg add "${missing[@]}" || warn "could not install: ${missing[*]}" +fi + +if ((${#missing_aur[@]})); then + if omarchy pkg aur accessible; then + omarchy pkg aur add "${missing_aur[@]}" || warn "could not install from the AUR: ${missing_aur[*]}" + else + warn "the AUR is unreachable, skipping: ${missing_aur[*]}" + fi +fi + +for installer in "${installers[@]}"; do + # Word-split on purpose: routes are two words ("editor zed"). + # shellcheck disable=SC2086 + omarchy install $installer || warn "'omarchy install $installer' failed" +done +{{ end -}} diff --git a/root/.chezmoiscripts/run_onchange_after_01-mise-install.ps1.tmpl b/root/.chezmoiscripts/run_onchange_after_01-mise-install.ps1.tmpl index 9d4a2f2..c37f547 100644 --- a/root/.chezmoiscripts/run_onchange_after_01-mise-install.ps1.tmpl +++ b/root/.chezmoiscripts/run_onchange_after_01-mise-install.ps1.tmpl @@ -1,5 +1,5 @@ {{ if eq .chezmoi.os "windows" -}} -# mise config hash: {{ include "private_dot_config/mise/config.toml.tmpl" | sha256sum }} +# mise config hash: {{ include "private_dot_config/mise/conf.d/10-dotfiles.toml.tmpl" | sha256sum }} if (Get-Command mise -ErrorAction SilentlyContinue) { mise install --yes --quiet diff --git a/root/.chezmoiscripts/run_onchange_after_01-mise-install.sh.tmpl b/root/.chezmoiscripts/run_onchange_after_01-mise-install.sh.tmpl index 3561252..60b4ecd 100644 --- a/root/.chezmoiscripts/run_onchange_after_01-mise-install.sh.tmpl +++ b/root/.chezmoiscripts/run_onchange_after_01-mise-install.sh.tmpl @@ -1,7 +1,7 @@ {{ if ne .chezmoi.os "windows" -}} #!/bin/bash -# mise config hash: {{ include "private_dot_config/mise/config.toml.tmpl" | sha256sum }} +# mise config hash: {{ include "private_dot_config/mise/conf.d/10-dotfiles.toml.tmpl" | sha256sum }} if ! command -v mise >/dev/null 2>&1; then echo "mise not found, skipping tool install" diff --git a/root/.chezmoiscripts/run_onchange_after_02-install-completions.sh.tmpl b/root/.chezmoiscripts/run_onchange_after_02-install-completions.sh.tmpl index e463a06..b6b0500 100644 --- a/root/.chezmoiscripts/run_onchange_after_02-install-completions.sh.tmpl +++ b/root/.chezmoiscripts/run_onchange_after_02-install-completions.sh.tmpl @@ -1,9 +1,9 @@ -{{ if ne .chezmoi.os "windows" -}} +{{ if and (ne .chezmoi.os "windows") (not .isOmarchy) -}} #!/bin/bash # Regenerate whenever any pinned tool version changes, not just when this # script changes — otherwise completions go stale as tools upgrade. -# mise config hash: {{ include "private_dot_config/mise/config.toml.tmpl" | sha256sum }} +# mise config hash: {{ include "private_dot_config/mise/conf.d/10-dotfiles.toml.tmpl" | sha256sum }} # Freshly mise-installed tools aren't on this non-interactive script's PATH # during the first apply (01-mise-install runs just before this); the shims diff --git a/root/.chezmoiscripts/run_onchange_after_07-omarchy-theme.sh.tmpl b/root/.chezmoiscripts/run_onchange_after_07-omarchy-theme.sh.tmpl new file mode 100644 index 0000000..3030d24 --- /dev/null +++ b/root/.chezmoiscripts/run_onchange_after_07-omarchy-theme.sh.tmpl @@ -0,0 +1,31 @@ +{{ if .isOmarchy -}} +{{- $themes := glob (joinPath .chezmoi.sourceDir "private_dot_config/omarchy/themes/*/colors.toml") -}} +#!/bin/bash + +# Re-derive the active theme's per-app files when chezmoi changes its colors, +# without ever choosing a theme. +# +# Theme definitions are synced so every machine has them in the switcher; the +# active selection (~/.local/state/omarchy/current/theme.name) is not, so +# machines sharing these dotfiles can still look different. Omarchy compiles a +# theme's colors.toml into per-app files (ghostty.conf, btop.theme, ...) only +# when a theme is set or refreshed, so if chezmoi just changed the colors of +# the theme active here, those files are stale until it is refreshed. +# +# colors.toml hashes: {{ range $themes }}{{ include . | sha256sum | trunc 12 }} {{ end }} + +set -euo pipefail + +managed_themes=({{ range $themes }}{{ base (dir .) | quote }} {{ end }}) +current=$(cat "$HOME/.local/state/omarchy/current/theme.name" 2>/dev/null || true) + +for theme in "${managed_themes[@]}"; do + [[ $theme == "$current" ]] || continue + if [[ -z ${HYPRLAND_INSTANCE_SIGNATURE:-} ]]; then + echo "omarchy-theme: no Hyprland session; run 'omarchy theme refresh' to re-derive $theme" + exit 0 + fi + echo "omarchy-theme: refreshing the active theme, $theme" + omarchy theme refresh || echo "omarchy-theme: 'omarchy theme refresh' failed" >&2 +done +{{ end -}} diff --git a/root/.chezmoitemplates/claude-settings.json b/root/.chezmoitemplates/claude-settings.json index 61d6b66..d5b657e 100644 --- a/root/.chezmoitemplates/claude-settings.json +++ b/root/.chezmoitemplates/claude-settings.json @@ -1,5 +1,8 @@ { "$schema": "https://json.schemastore.org/claude-code-settings.json", +{{- if .isOmarchy }} + "theme": "custom:omarchy", +{{- end }} "alwaysThinkingEnabled": true, "showThinkingSummaries": true, "effortLevel": "high", diff --git a/root/.chezmoitemplates/shell-abbreviations b/root/.chezmoitemplates/shell-abbreviations new file mode 100644 index 0000000..f385ced --- /dev/null +++ b/root/.chezmoitemplates/shell-abbreviations @@ -0,0 +1,4 @@ +# Abbreviations shared by every shell; edit root/.chezmoidata/shell.toml. +{{ range $name, $expansion := .shell.abbreviations -}} +alias {{ $name }}={{ $expansion | squote }} +{{ end -}} diff --git a/root/dot_bashrc.tmpl b/root/dot_bashrc.tmpl index ead0cfb..705aea4 100644 --- a/root/dot_bashrc.tmpl +++ b/root/dot_bashrc.tmpl @@ -1,3 +1,14 @@ +{{ if .isOmarchy -}} +# Omarchy environment (OMARCHY_PATH + PATH), needed even for non-interactive shells +[[ -r /usr/share/omarchy/default/bash/env-bootstrap ]] && source /usr/share/omarchy/default/bash/env-bootstrap + +# If not running interactively, don't do anything else (leave this above the rc source) +[[ $- != *i* ]] && return + +# All the default Omarchy aliases and functions, including the prompt, mise, +# zoxide, fzf and history setup. Everything below layers on top of them. +source "$OMARCHY_PATH/default/bash/rc" +{{ else -}} {{ if .isMac -}} # Homebrew completion (macOS) if command -v brew >/dev/null 2>&1; then @@ -10,10 +21,12 @@ fi export PATH="$HOME/.opencode/bin:$PATH" export PATH="{{ .binDirAbs }}:$PATH" +{{- end }} {{ template "env-posix" . }} {{- if .bitwardenSshAgent }} export SSH_AUTH_SOCK="$({{ .binDirAbs }}/bitwarden-ssh-sock)" {{- end }} +{{- if not .isOmarchy }} if command -v starship >/dev/null 2>&1; then eval "$(starship init bash)" @@ -26,6 +39,7 @@ fi if command -v zoxide >/dev/null 2>&1; then eval "$(zoxide init bash)" fi +{{- end }} if command -v mcfly >/dev/null 2>&1; then eval "$(mcfly init bash)" @@ -36,6 +50,7 @@ fi fzkill() { ps -eo pid,args,%mem,%cpu | fzf --multi --header-lines=1 | awk '{print $1}' | xargs kill "$@" } +{{- if not .isOmarchy }} HISTFILE=~/.bash_history HISTSIZE=20000 @@ -43,3 +58,8 @@ HISTFILESIZE=20000 HISTCONTROL=ignoreboth:erasedups shopt -s histappend shopt -s cmdhist +{{- end }} + +{{ template "shell-abbreviations" . }} +# Per-machine overrides, never managed by the dotfiles. +[[ -r ~/.config/local/shell.sh ]] && source ~/.config/local/shell.sh diff --git a/root/dot_gitconfig.tmpl b/root/dot_gitconfig.tmpl index 2f65008..710a499 100644 --- a/root/dot_gitconfig.tmpl +++ b/root/dot_gitconfig.tmpl @@ -2,12 +2,8 @@ name = Carson Seese email = {{ .personalEmail }} {{- if .gitSign }} -{{- if .gitSigningKeyFile }} - signingkey = {{ .gitSigningKeyFile | replace "\\" "/" }} -{{- else }} signingkey = key::{{ .gitSigningPubKey }} {{- end }} -{{- end }} {{ if and .isWork (not .isDc) -}} [includeIf "gitdir:~/dev/work/"] @@ -34,6 +30,30 @@ [rerere] enabled = true + autoupdate = true + +[init] + defaultBranch = main + +[push] + autoSetupRemote = true + +[diff] + algorithm = histogram + colorMoved = plain + mnemonicPrefix = true + +[commit] + verbose = true + +[column] + ui = auto + +[branch] + sort = -committerdate + +[tag] + sort = -version:refname {{ if eq .os "windows" -}} [credential] @@ -68,7 +88,16 @@ {{- end }} [alias] + co = checkout + br = branch + ci = commit + st = status pushfwl = push --force-with-lease [pull] rebase = true + +# Per-machine overrides, never managed by the dotfiles. Last, so it wins; git +# skips the include when the file doesn't exist. +[include] + path = ~/.config/local/gitconfig diff --git a/root/dot_local/bin/executable_clean b/root/dot_local/bin/executable_clean index 43ae7ab..32a90d0 100644 --- a/root/dot_local/bin/executable_clean +++ b/root/dot_local/bin/executable_clean @@ -1,7 +1,8 @@ #!/bin/bash # Prune old and unused packages left behind by `update`: orphaned system -# packages and package caches (apt/brew), and mise tool versions no longer +# packages and package caches (apt/pacman/brew; on Omarchy `omarchy update` +# already does this), and mise tool versions no longer # referenced by any config, plus mise's download cache. # # Managed by chezmoi; installed to ~/.local/bin so it works from any shell. @@ -17,7 +18,12 @@ Darwin) brew cleanup --prune=all ;; Linux) - if command -v apt-get >/dev/null 2>&1; then + if [[ -r /etc/os-release ]] && grep -qx 'ID=omarchy' /etc/os-release; then + # `omarchy update` already removes orphans and prunes the cache, but + # keeps two versions of each package (paccache -rk2): its offline + # rollback path, which `pacman -Sc` would empty. + step "Skipping system packages (omarchy update prunes them)" + elif command -v apt-get >/dev/null 2>&1; then step "Pruning apt packages and caches" sudo apt-get autoremove --purge -y sudo apt-get clean diff --git a/root/dot_local/bin/executable_update b/root/dot_local/bin/executable_update index 068a62e..61e27fb 100644 --- a/root/dot_local/bin/executable_update +++ b/root/dot_local/bin/executable_update @@ -1,8 +1,9 @@ #!/bin/bash -# Update everything on this machine: system packages (apt/brew), mise, -# chezmoi, the dotfiles themselves, mise-managed tools, and the coding-agent -# CLIs that install.sh sets up outside mise. +# Update everything on this machine: system packages (apt/pacman/brew, or +# `omarchy update` on Omarchy), mise, chezmoi, the dotfiles themselves, +# mise-managed tools, and the coding-agent CLIs that install.sh sets up +# outside mise. # # Managed by chezmoi; installed to ~/.local/bin so it works from any shell. @@ -10,6 +11,17 @@ set -eufo pipefail step() { printf '\n\033[1;34m==>\033[0m \033[1m%s\033[0m\n' "$1"; } +is_omarchy() { + [[ -r /etc/os-release ]] && grep -qx 'ID=omarchy' /etc/os-release +} + +# Omarchy's mise config provides most agent CLIs itself (and updates them), +# unless this user opted out of Omarchy's default tools. +omarchy_provides() { + is_omarchy && command -v omarchy-mise-default-tools >/dev/null 2>&1 && + omarchy-mise-default-tools declares "$1" +} + # Everything lives inside main so bash parses the whole script before any of # it runs: `chezmoi update` below re-applies the dotfiles, which can rewrite # this very file mid-execution. @@ -20,7 +32,14 @@ main() { brew update && brew upgrade ;; Linux) - if command -v apt-get >/dev/null 2>&1; then + if is_omarchy; then + # Omarchy blocks a direct `pacman -Syu` (a libalpm hook aborts it). + # Its own entrypoint also snapshots, refreshes keyrings, runs + # migrations and hooks, and updates AUR packages and mise tools. + # -y skips its confirmations, so a kernel update reports that a + # reboot is due instead of prompting for one. + omarchy update -y + elif command -v apt-get >/dev/null 2>&1; then sudo apt-get update && sudo apt-get upgrade -y elif command -v pacman >/dev/null 2>&1; then sudo pacman -Syu --noconfirm @@ -37,12 +56,20 @@ main() { fi # Upgrade the chezmoi binary before pulling the dotfiles: newer templates - # may require a newer chezmoi (.chezmoiversion). + # may require a newer chezmoi (.chezmoiversion). `chezmoi upgrade` replaces + # the binary in place, so a package-managed (root-owned) chezmoi is left to + # the system-package step above, same as mise. step "Updating chezmoi" - chezmoi upgrade + if [[ -w "$(command -v chezmoi)" ]]; then + chezmoi upgrade + else + echo "chezmoi is package-managed, updated with the system packages" + fi step "Pulling latest dotfiles and applying" - chezmoi update + # --init regenerates the config from the freshly pulled .chezmoi.toml.tmpl, + # so data keys the new templates rely on exist before they are applied. + chezmoi update --init # After the pull: the applied mise config may pin newer tool versions. if command -v mise >/dev/null 2>&1; then @@ -53,10 +80,12 @@ main() { # Installed by install.sh with each vendor's own installer rather than # mise, so they can self-update; this runs that same updater on demand. # Each is optional (macOS/Windows don't get them), and one failing - # shouldn't stop the rest. - local tool - for tool in "claude update" "codex update" "copilot update" "agy update" "opencode upgrade"; do - if command -v "${tool%% *}" >/dev/null 2>&1; then + # shouldn't stop the rest. Format: ":". + local entry tool + for entry in "claude update:claude" "codex update:codex" "copilot update:copilot" \ + "agy update:antigravity-cli" "opencode upgrade:opencode"; do + tool=${entry%%:*} + if command -v "${tool%% *}" >/dev/null 2>&1 && ! omarchy_provides "${entry##*:}"; then step "Updating ${tool%% *}" $tool || echo "${tool%% *} update failed, skipping" fi diff --git a/root/dot_ssh/allowed_signers.tmpl b/root/dot_ssh/allowed_signers.tmpl index 0a82807..e464035 100644 --- a/root/dot_ssh/allowed_signers.tmpl +++ b/root/dot_ssh/allowed_signers.tmpl @@ -1,6 +1,6 @@ -{{ if and .gitSign .gitSigningPubKey .personalEmail -}} +{{ if .gitSign -}} {{ .personalEmail }} {{ .gitSigningPubKey }} -{{ end -}} -{{ if and .gitSign .gitSigningPubKey .workEmail -}} +{{ if .workEmail -}} {{ .workEmail }} {{ .gitSigningPubKey }} {{ end -}} +{{ end -}} diff --git a/root/dot_zshrc.tmpl b/root/dot_zshrc.tmpl index 4c46571..af01cb2 100644 --- a/root/dot_zshrc.tmpl +++ b/root/dot_zshrc.tmpl @@ -48,4 +48,8 @@ setopt HIST_IGNORE_ALL_DUPS setopt HIST_IGNORE_SPACE setopt HIST_SAVE_NO_DUPS setopt APPEND_HISTORY -setopt SHARE_HISTORY \ No newline at end of file +setopt SHARE_HISTORY + +{{ template "shell-abbreviations" . }} +# Per-machine overrides, never managed by the dotfiles. +[[ -r ~/.config/local/shell.sh ]] && source ~/.config/local/shell.sh \ No newline at end of file diff --git a/root/private_dot_config/fish/conf.d/abbreviations.fish.tmpl b/root/private_dot_config/fish/conf.d/abbreviations.fish.tmpl new file mode 100644 index 0000000..a908d96 --- /dev/null +++ b/root/private_dot_config/fish/conf.d/abbreviations.fish.tmpl @@ -0,0 +1,4 @@ +# Abbreviations shared by every shell; edit root/.chezmoidata/shell.toml. +{{ range $name, $expansion := .shell.abbreviations -}} +abbr -a {{ $name }} {{ $expansion | squote }} +{{ end -}} diff --git a/root/private_dot_config/fish/conf.d/alias.fish b/root/private_dot_config/fish/conf.d/alias.fish index 11b90a5..660fd72 100644 --- a/root/private_dot_config/fish/conf.d/alias.fish +++ b/root/private_dot_config/fish/conf.d/alias.fish @@ -1,32 +1,7 @@ -abbr -a g git -abbr -a gs git status -sb -abbr -a ga git add -abbr -a gc git commit -abbr -a gcm git commit -m -abbr -a gca git commit --amend -abbr -a gcl git clone -abbr -a gco git checkout -abbr -a gp git push -abbr -a gpf git push --force-with-lease -abbr -a gpl git pull -abbr -a gl git l -abbr -a gd git diff -abbr -a gds git diff --staged -abbr -a gf git fetch - -abbr -a cma chezmoi apply -abbr -a cmu chezmoi update -abbr -a cmcd chezmoi cd - -abbr -a mls mise ls -abbr -a mi mise install -abbr -a mup mise upgrade -abbr -a mus mise use - alias l="ls -l" alias la="ls -a" alias lla="ls -la" alias lt="ls --tree" alias ls=lsd -alias reload="exec fish" \ No newline at end of file +alias reload="exec fish" diff --git a/root/private_dot_config/fish/conf.d/claude.fish b/root/private_dot_config/fish/conf.d/claude.fish deleted file mode 100644 index abba442..0000000 --- a/root/private_dot_config/fish/conf.d/claude.fish +++ /dev/null @@ -1,4 +0,0 @@ -abbr -a cc claude -abbr -a ccr claude --resume -abbr -a ccc claude --continue -abbr -a ccp claude -p diff --git a/root/private_dot_config/fish/config.fish.tmpl b/root/private_dot_config/fish/config.fish.tmpl index d855f12..eb56401 100644 --- a/root/private_dot_config/fish/config.fish.tmpl +++ b/root/private_dot_config/fish/config.fish.tmpl @@ -34,6 +34,9 @@ fish_add_path {{ .binDirAbs | quote }} {{ if .bitwardenSshAgent -}} set -gx SSH_AUTH_SOCK ({{ .binDirAbs }}/bitwarden-ssh-sock) -{{- else if not .isDc -}} +{{- else if .isWsl -}} fish_ssh_agent -{{- end }} \ No newline at end of file +{{- end }} + +# Per-machine overrides, never managed by the dotfiles. +test -r ~/.config/local/shell.fish; and source ~/.config/local/shell.fish \ No newline at end of file diff --git a/root/private_dot_config/fish/functions/fish_ssh_agent.fish b/root/private_dot_config/fish/functions/fish_ssh_agent.fish index 58f0a1d..d20750b 100644 --- a/root/private_dot_config/fish/functions/fish_ssh_agent.fish +++ b/root/private_dot_config/fish/functions/fish_ssh_agent.fish @@ -20,15 +20,9 @@ function __ssh_agent_start -d "start a new ssh agent" end -function fish_ssh_agent --description "Start ssh-agent or load keys from the macOS Keychain." - # macOS: launchd already runs a Keychain-aware ssh-agent at SSH_AUTH_SOCK. - # Pull any passphrases previously saved via `ssh-add --apple-use-keychain` - # into that agent so git/ssh stop prompting. - if test (uname -s) = Darwin - ssh-add --apple-load-keychain --quiet 2>/dev/null - return - end - +# WSL only: Bitwarden runs on the Windows side, where its agent socket is +# unreachable, so WSL keeps one ssh-agent shared across its shells. +function fish_ssh_agent --description "Start ssh-agent, or reuse the one already running" if test -z "$SSH_ENV" set -xg SSH_ENV $HOME/.ssh/environment end diff --git a/root/private_dot_config/hypr/input.lua b/root/private_dot_config/hypr/input.lua new file mode 100644 index 0000000..f71f11a --- /dev/null +++ b/root/private_dot_config/hypr/input.lua @@ -0,0 +1,28 @@ +-- Managed by chezmoi. Only the overrides on top of Omarchy's defaults +-- ($OMARCHY_PATH/default/hypr/input.lua) live here; per-machine tweaks such as +-- pointer sensitivity go in ~/.config/local/hypr.lua (see looknfeel.lua). + +-- Caps Lock is Escape. This replaces Omarchy's kb_options +-- ("omarchy:shift_caps_compose"), so Shift + Caps Lock is no longer compose. +hl.config({ + input = { + kb_options = "caps:escape", + }, +}) + +-- Touchpad only, so inert on machines without one: macOS-style "natural" +-- scrolling (content follows your fingers), tap-and-drag with a short grace +-- period to lift and reposition mid-drag. disable_while_typing stays at its +-- default (on); it keeps the cursor from jumping mid-sentence. +hl.config({ + input = { + touchpad = { + natural_scroll = true, + tap_and_drag = true, + drag_lock = 2, + }, + }, +}) + +-- https://wiki.hypr.land/Configuring/Advanced-and-Cool/Gestures/ +hl.gesture({ fingers = 3, direction = "horizontal", action = "workspace" }) diff --git a/root/private_dot_config/hypr/looknfeel.lua b/root/private_dot_config/hypr/looknfeel.lua new file mode 100644 index 0000000..9fedb65 --- /dev/null +++ b/root/private_dot_config/hypr/looknfeel.lua @@ -0,0 +1,24 @@ +-- Managed by chezmoi. Only the overrides on top of Omarchy's defaults +-- ($OMARCHY_PATH/default/hypr/looknfeel.lua) live here. + +-- Tighter margins around windows (Omarchy's defaults are gaps_in 5 / +-- gaps_out 10), without butting windows straight up against the bar. +hl.config({ + general = { + gaps_in = 2, + gaps_out = 4, + }, + + -- Softer corners. Rounding has to stay a little larger than border_size or + -- the border reads as a hard notch at the corner. + decoration = { + rounding = 8, + }, +}) + +-- Per-machine overrides, never managed by the dotfiles: ~/.config/local/hypr.lua. +-- Loaded here because this is the last managed file hyprland.lua requires, so +-- it can override input.lua as well. Cleared first so `hyprctl reload` re-runs +-- it; Omarchy's bootstrap only clears modules under its own prefixes. +package.loaded["local.hypr"] = nil +require("default.hypr.require_optional").module("local.hypr") diff --git a/root/private_dot_config/mise/config.toml.tmpl b/root/private_dot_config/mise/conf.d/10-dotfiles.toml.tmpl similarity index 78% rename from root/private_dot_config/mise/config.toml.tmpl rename to root/private_dot_config/mise/conf.d/10-dotfiles.toml.tmpl index db519f4..44c0ac5 100644 --- a/root/private_dot_config/mise/config.toml.tmpl +++ b/root/private_dot_config/mise/conf.d/10-dotfiles.toml.tmpl @@ -1,27 +1,37 @@ +# Managed by chezmoi as a conf.d drop-in, so ~/.config/mise/config.toml stays +# free for `mise use -g` (yours, or Omarchy's agent wrappers). A tool pinned +# there outranks the pin here. [tools] -starship = "1.27.0" -lazygit = "0.66.2" lazydocker = "0.25.2" ast-grep = "0.51.1" hyperfine = "2.0.0" duf = "0.9.1" -fd = "10.5.0" -fzf = "0.74.5" -jq = "1.8.2" -ripgrep = "15.2.0" lsd = "1.2.0" gh = "2.103.3" -zoxide = "0.10.0" worktrunk = "0.81.0" cloudflared = "2026.10.7" aube = "2.8.5" -usage = "6.12.1" hunk = "0.24.1" "github:Ataraxy-Labs/sem" = "0.29.0" "github:backnotprop/plannotator" = "0.28.45" +{{ if not .isOmarchy -}} +# Omarchy installs these as system packages. +starship = "1.27.0" +lazygit = "0.66.2" +fd = "10.5.0" +fzf = "0.74.5" +jq = "1.8.2" +ripgrep = "15.2.0" +zoxide = "0.10.0" +usage = "6.12.1" +{{ end -}} {{ if ne .chezmoi.os "windows" -}} +{{ if not .isOmarchy -}} +# Omarchy ships herdr as a package and deletes mise copies of it: a stale +# client would shadow /usr/bin/herdr with an older wire protocol. herdr = "0.9.5" +{{ end -}} zellij = "0.45.1" "github:zyedidia/eget" = "1.3.4" {{- end }} diff --git a/root/private_dot_config/mise/modify_config.toml b/root/private_dot_config/mise/modify_config.toml new file mode 100644 index 0000000..0b2e3f5 --- /dev/null +++ b/root/private_dot_config/mise/modify_config.toml @@ -0,0 +1,16 @@ +{{- /* chezmoi:modify-template */ -}} +{{- /* + ~/.config/mise/config.toml belongs to `mise use -g` (yours, or the fallback in + Omarchy's agent wrappers); the dotfiles' pins live in conf.d/10-dotfiles.toml. + Machines from before that move still have a config.toml the dotfiles wrote, + and config.toml outranks conf.d, so its stale pins would win forever. + + Recognise that file by a top-level settings line every dotfiles version + since Sep 2025 carried and `mise use -g` never writes, and remove it (empty + output removes the target). Anything else passes through byte-for-byte, so + this never shows up as a diff and never creates the file. +*/ -}} +{{- $current := .chezmoi.stdin -}} +{{- if not (regexMatch "(?m)^(minimum_release_age|idiomatic_version_file_enable_tools)\\s*=" $current) -}} +{{- $current -}} +{{- end -}} diff --git a/root/private_dot_config/omarchy/themes/portland-head/backgrounds/0-portland-head.jpg b/root/private_dot_config/omarchy/themes/portland-head/backgrounds/0-portland-head.jpg new file mode 100644 index 0000000..04519ab Binary files /dev/null and b/root/private_dot_config/omarchy/themes/portland-head/backgrounds/0-portland-head.jpg differ diff --git a/root/private_dot_config/omarchy/themes/portland-head/colors.toml b/root/private_dot_config/omarchy/themes/portland-head/colors.toml new file mode 100644 index 0000000..90dbacc --- /dev/null +++ b/root/private_dot_config/omarchy/themes/portland-head/colors.toml @@ -0,0 +1,36 @@ +# Portland Head +# Every hue below is sampled from the image in backgrounds/ and then lifted for +# contrast: the sky over the headland is the accent, the harbor water in shadow +# is the background, and the whitewashed tower is the brightest foreground. + +mode = "dark" + +accent = "#6595cd" +selection = "#1b3b52" +muted = "#3f5f75" + +background = "#0c1a24" +dark_background = "#091420" +darker_background = "#060e17" +lighter_background = "#132836" + +foreground = "#aec0cf" +dark_foreground = "#5a7285" +light_foreground = "#bfcedb" +bright_foreground = "#dce6ee" + +red = "#b3766a" +yellow = "#c2a468" +orange = "#b57a55" +green = "#7a8a52" +cyan = "#4d8ba3" +blue = "#6595cd" +magenta = "#9080b0" +brown = "#7a6a5c" + +bright_red = "#c4826f" +bright_yellow = "#dcc084" +bright_green = "#9aab6c" +bright_cyan = "#6fb0c7" +bright_blue = "#82afdb" +bright_magenta = "#ab9bc9" diff --git a/scripts/generate-signing-key.sh b/scripts/generate-signing-key.sh deleted file mode 100755 index 1243b1e..0000000 --- a/scripts/generate-signing-key.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# Ensure an SSH commit-signing key exists at ~/.ssh/git_signing. -# -# For hosts whose rendered chezmoi config sets `signingKeyFileWanted`: no -# Bitwarden agent, not a dev container, not WSL. Idempotent: a no-op if the -# key already exists. -# -# chezmoi reads the public key into `gitSigningPubKey` and the private key -# path into `gitSigningKeyFile` at render time, so re-run `chezmoi init` -# after generating. - -set -eufo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -source "$SCRIPT_DIR/lib.sh" - -KEY_PATH="${HOME}/.ssh/git_signing" - -if [[ -f "$KEY_PATH" ]]; then - log_info "Signing key already exists at $KEY_PATH" - exit 0 -fi - -mkdir -p "${HOME}/.ssh" -chmod 700 "${HOME}/.ssh" - -log_info "Generating SSH commit-signing key at $KEY_PATH" -# Passphrase-less so signing needs no agent; protected by filesystem perms. -ssh-keygen -t ed25519 -f "$KEY_PATH" -N "" -C "git signing ($(hostname))" -chmod 600 "$KEY_PATH" -chmod 644 "${KEY_PATH}.pub" -log_success "Signing key generated" - -if command -v gh >/dev/null 2>&1 && gh auth status >/dev/null 2>&1; then - if gh ssh-key add "${KEY_PATH}.pub" --type signing --title "git signing ($(hostname))"; then - log_success "Uploaded signing key to GitHub" - exit 0 - fi - log_warn "Automatic upload failed — add the key manually:" -fi - -echo -log_warn "Add this PUBLIC key to GitHub as a Signing Key:" -log_warn " https://github.com/settings/ssh/new (Key type: Signing Key)" -echo -cat "${KEY_PATH}.pub" -echo