refactor: remove restic timers, add scripts/configs, update docs

- resticprofile: remove all schedules (manual backups via backup-menu)
- resticprofile: fix hardcoded /home/ada paths → ~/
- proj(): find git repos by .git presence up to depth 4
- bootstrap.sh: add fzf, fd, bat, ripgrep, kitty, htop to packages
- README.md: rewrite for chezmoi (remove stow references)
- add: htoprc, betterbird_up.sh, kitty_up.sh, tg_up.sh
This commit is contained in:
Dmitry
2026-05-13 19:47:46 +03:00
parent babe53d929
commit 02b0ca610d
8 changed files with 157 additions and 139 deletions
+62 -127
View File
@@ -1,156 +1,91 @@
# Dotfiles
Мой репозиторий конфигурационных файлов.
Мой репозиторий конфигурационных файлов. Управляется **chezmoi**.
## Быстрый старт
## Установка ssh-ключей через bitwarden-cli
```bash
git clone <repository-url> ~/dotfiles
~/.config/chezmoi/key.txt # восстановить age-ключ из Bitwarden (см. ниже)
cd ~/dotfiles && ./bootstrap.sh
```
`bootstrap.sh` устанавливает зависимости и запускает `chezmoi apply`.
## Age-ключ (шифрование секретов)
Ключ хранится в Bitwarden (`pass.ada-dev.ru`):
```bash
bw config server https://pass.ada-dev.ru
bw login
bw get item <название ключа> | jq -r '.sshKey.privateKey' > ~/.ssh/id_ed25519
bw get item "chezmoi-age-key" | jq -r '.notes' > ~/.config/chezmoi/key.txt
chmod 600 ~/.config/chezmoi/key.txt
```
## Установка
Без ключа chezmoi не расшифрует SSH-ключи и пароль restic.
## SSH-ключи
Хранятся зашифрованными в репо (`private_dot_ssh/encrypted_private_*.age`).
chezmoi расшифровывает их при `apply`. Дополнительных действий не нужно.
Если нужно добавить ключ вручную из Bitwarden:
```bash
git clone <repository-url> ~/.dotfiles
cd ~/.dotfiles
mkdir -p ~/.ssh/sockets
stow -t ~ */
bw get item <название> | jq -r '.sshKey.privateKey' > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
```
## Resticprofile: Резервные копии
Конфигурация автоматического резервного копирования данных на Яндекс.Диск через rclone.
### На уже настроенной машине
После синхронизации dotfiles резервные копии начнут создаваться автоматически по расписанию. Возможные команды:
**Статус и информация:**
## Управление dotfiles
```bash
resticprofile status # список всех профилей и их статуса
resticprofile profiles # показать все доступные профили
resticprofile show [profile] # подробно о профиле
chezmoi apply # применить изменения из репо
chezmoi diff # посмотреть что изменится
chezmoi status # краткий статус
chezmoi re-add # синхронизировать после ручных правок в ~
chezmoi add ~/.some/file # начать отслеживать новый файл
```
**Создание резервной копии вручную:**
## Резервные копии (restic)
Бэкапы запускаются вручную через `backup-menu` (алиас `bm`).
Хранилище — Яндекс.Диск через rclone remote `yadisk`, зеркало — `cloud-pc`.
| Профиль | Источник |
|---|---|
| `dotfiles` | `~/.dotfiles`, `~/.config`, `~/.ssh` |
| `projects` | `~/Documents/Projects` |
| `vaults` | `~/Documents/Vaults` |
| `files` | `~/Documents/Files` |
| `pictures` | `~/Pictures` |
```bash
resticprofile backup # backup для всей группы 'all'
resticprofile -n dotfiles backup # backup определённого профиля (напр. dotfiles)
resticprofile -n projects backup # backup проектов
bm # интерактивное меню
resticprofile -n dotfiles backup # вручную
resticprofile -n dotfiles snapshots # просмотр снапшотов
resticprofile -n dotfiles restore latest /tmp/restore
```
**Просмотр снимков:**
На новой машине нужно настроить rclone один раз:
```bash
resticprofile snapshots # список всех снимков
resticprofile -n dotfiles snapshots # снимки конкретного профиля
rclone config # добавить remote 'yadisk' и 'cloud-pc'
```
**Очистка старых снимков:**
## Структура репо
```bash
resticprofile forget # удалить старые снимки согласно политике
resticprofile -n dotfiles forget # очистить конкретный профиль
```
**Восстановление данных:**
```bash
resticprofile -n dotfiles restore latest /tmp/restore # восстановить в /tmp/restore
resticprofile -n dotfiles restore <snapshot-id> /path # конкретный снимок
dot_config/ → ~/.config/
zsh/ → zsh конфиг (модульный, загружается из .zshrc)
nvim/ → LazyVim
kitty/ → основной терминал
alacritty/ → запасной терминал
resticprofile/ → конфиг бэкапов
...
private_dot_ssh/ → ~/.ssh/ (права 700/600, ключи зашифрованы)
dot_local/bin/ → ~/.local/bin/ (пользовательские скрипты)
dot_gitconfig → ~/.gitconfig
dot_tmux.conf.local → ~/.tmux.conf.local (кастомизация oh-my-tmux)
configs/ → служебные конфиги вне chezmoi (danted, awg, telemt)
```
**Проверка целостности:**
```bash
resticprofile -n dotfiles check # проверить репозиторий
```
### На новой машине
1. **Клонизация dotfiles:**
```bash
git clone <repository-url> ~/.dotfiles
cd ~/.dotfiles
mkdir -p ~/.ssh/sockets
```
2. **Развёртывание конфигов (stow):**
```bash
stow -t ~ */
```
Это разместит конфиги из `restic/.config/resticprofile/` в `~/.config/resticprofile/`
3. **Установка rclone и resticprofile** (если нет):
```bash
# rclone (для работы с облаком)
curl https://rclone.org/install.sh | sudo bash
# resticprofile (управление бэкапами)
# или через пакетный менеджер вашей системы
```
t
4. **Настройка rclone** (нужно один раз):
```bash
rclone config
# Добавить remote 'yadisk' для Яндекс.Диска
# Использовать OAuth или AppPassword для авторизации
```
5. **Установка пароля для репозитория restic:**
Убедитесь, что файл `~/.config/resticprofile/pass.txt` содержит пароль для шифрования бэкапов (он же, что на основной машине).
6. **Проверка подключения к существующему репозиторию:**
```bash
resticprofile -n dotfiles snapshots # проверить доступ к репозиторию
```
Если вывод показывает список снимков — подключение работает.
7. **Восстановление данных из последних бэкапов:**
```bash
# Восстановить kritical данные (dotfiles, конфиги, SSH)
resticprofile -n dotfiles restore latest /
# Или выборочно в временную папку для проверки
resticprofile -n dotfiles restore latest /tmp/restore
```
8. **Включение в systemd** (опционально, для автозапуска):
```bash
resticprofile install
resticprofile schedule
```
### Структура профилей
| Профиль | Источник | Частота | Назначение |
| ------------------ | ------------------------------ | ---------------------------------------------- | -------------------------------------------------------------- |
| **dotfiles** | ~/.dotfiles, ~/.config, ~/.ssh | Каждые 6 часов | Критичные конфигурационные файлы |
| **projects** | ~/Documents/Projects | Каждый час | Код и проекты (меняются часто) |
| **vaults** | ~/Documents/Vaults | Каждый час | Важные данные и пароли |
| **files** | ~/Documents/Files | Ежедневно в 02:15 | Документы |
| **pictures** | ~/Pictures, ~/Videos | По групповому расписанию | Фотографии и видео |
**Политика хранения:**
- Последние 10 снимков (общая)
- Ежедневные (7 дней)
- Еженедельные (4 недели)
- Ежемесячные (6 месяцев)
- Профиль `dotfiles`: более агрессивная политика (28 часов, 30 дней, 12 месяцев)
### Полезные параметры конфига
- `check-before: false` — не проверять целостность перед бэкапом (для скорости)
- `use-fs-snapshot: false` — не использовать снимки файловой системы
- `.resticignore` — исключает тяжёлые зависимости (node_modules, venv, target и т.д.)
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
PACKAGES=("zsh" "tmux" "alacritty" "chezmoi" "age" "eza" "zoxide")
PACKAGES=("zsh" "tmux" "alacritty" "kitty" "chezmoi" "age" "fzf" "fd" "bat" "ripgrep" "eza" "zoxide" "htop")
detect_and_install() {
if command -v apt &>/dev/null; then
+64
View File
@@ -0,0 +1,64 @@
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
htop_version=3.4.1-3.4.1
config_reader_min_version=3
fields=0 48 17 18 38 39 40 2 46 47 49 1
hide_kernel_threads=1
hide_userland_threads=0
hide_running_in_container=0
shadow_other_users=0
show_thread_names=0
show_program_path=1
highlight_base_name=0
highlight_deleted_exe=1
shadow_distribution_path_prefix=0
highlight_megabytes=1
highlight_threads=1
highlight_changes=0
highlight_changes_delay_secs=5
find_comm_in_cmdline=1
strip_exe_from_cmdline=1
show_merged_command=0
header_margin=1
screen_tabs=1
detailed_cpu_time=0
cpu_count_from_one=0
show_cpu_usage=1
show_cpu_frequency=0
show_cpu_temperature=0
degree_fahrenheit=0
show_cached_memory=1
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=0
enable_mouse=1
delay=15
hide_function_bar=0
header_layout=two_50_50
column_meters_0=LeftCPUs2 Memory Swap
column_meter_modes_0=1 1 1
column_meters_1=RightCPUs2 Tasks LoadAverage Uptime
column_meter_modes_1=1 2 2 2
tree_view=0
sort_key=46
tree_sort_key=0
sort_direction=-1
tree_sort_direction=1
tree_view_always_by_pid=0
all_branches_collapsed=0
screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command
.sort_key=PERCENT_CPU
.tree_sort_key=PID
.tree_view_always_by_pid=0
.tree_view=0
.sort_direction=-1
.tree_sort_direction=1
.all_branches_collapsed=0
screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command
.sort_key=IO_RATE
.tree_sort_key=PID
.tree_view_always_by_pid=0
.tree_view=0
.sort_direction=-1
.tree_sort_direction=1
.all_branches_collapsed=0
+2 -7
View File
@@ -8,7 +8,6 @@ groups:
- files-local
- pictures
- pictures-local
schedule: "0 * * * *"
projects:
repository: "rclone:yadisk:System/Backups/ada-x1/Documents/Projects"
@@ -16,7 +15,6 @@ projects:
backup:
source:
- ~/Documents/Projects
schedule: "*-*-* 20:30:00" # каждый час в 15 минут
forget:
keep-last: 24
keep-daily: 14
@@ -30,10 +28,10 @@ projects:
# Локальное зеркало projects
projects-local:
repository: "rclone:cloud-pc:pool/System/Backups/ada-x1/Documents/Projects"
password-file: "/home/ada/.config/resticprofile/pass.txt"
password-file: "~/.config/resticprofile/pass.txt"
backup:
source:
- /home/ada/Documents/Projects
- ~/Documents/Projects
forget:
keep-last: 24
keep-daily: 14
@@ -51,7 +49,6 @@ vaults:
backup:
source:
- ~/Documents/Vaults
schedule: "*-*-* 20:30:00"
forget:
keep-last: 12
keep-daily: 7
@@ -76,7 +73,6 @@ files:
backup:
source:
- ~/Documents/Files
schedule: "*-*-* 20:30:00" # 02:15 каждый день
forget:
keep-daily: 30
keep-weekly: 12
@@ -101,7 +97,6 @@ pictures:
backup:
source:
- ~/Pictures
schedule: "*-*-* 20:30:00" # 03:30 каждый день
forget:
keep-daily: 14
keep-weekly: 8
+4 -4
View File
@@ -298,10 +298,10 @@ proj() {
local target
if command -v fzf &>/dev/null; then
target=$(find "$base" -maxdepth 2 -mindepth 1 -type d \
\( -name .git -o -name node_modules -o -name .venv \) -prune \
-o -type d -print \
| sed "s|$base/||" \
# Ищем директории с .git (git-репозитории) до глубины 4
target=$(find "$base" -maxdepth 4 -name ".git" -type d \
| sed "s|/.git$||;s|$base/||" \
| sort \
| fzf --prompt "proj > " --height=40% --reverse) || return 0
elif [[ -n "$1" ]]; then
target="$1"
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
WID=$(kdotool search --class betterbird | head -1)
if [ -n "$WID" ]; then
kdotool windowactivate "$WID"
else
betterbird &
fi
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
SOCKET="unix:/tmp/kitty"
if kitty @ --to "$SOCKET" focus-window 2>/dev/null; then
kdotool search --class kitty | head -1 | xargs kdotool windowactivate
else
kitty --listen-on "$SOCKET" &
fi
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
WID=$(kdotool search --name "Telegram" | head -1)
if [ -n "$WID" ]; then
kdotool windowactivate "$WID"
else
org.telegram.desktop &
fi