curator/README.md

341 lines
8.6 KiB
Markdown
Raw Normal View History

2025-11-21 19:45:32 +05:30
# Forge - A Home-Manager Like Tool for Fedora
2025-11-19 22:42:28 +05:30
2025-11-21 20:22:02 +05:30
A lightweight configuration management tool for Fedora that provides COPR repository management, dotfile management and package installation functionality through a centralized TOML configuration.
2025-11-19 22:42:28 +05:30
## Overview
2025-11-21 19:45:32 +05:30
Forge is a bash script that helps you manage your Fedora system configuration by:
2025-11-21 20:22:02 +05:30
- Managing COPR repositories (enable/disable automatically)
2025-11-19 22:42:28 +05:30
- Installing and managing system packages via dnf
2025-11-21 19:45:32 +05:30
- Managing dotfiles through symlinks to actual files
- Centralized configuration via a single `forge.toml` file
- User-level configuration similar to home-manager/nixos
- Automatic backup of existing files before replacement
2025-11-19 22:42:28 +05:30
## Installation
1. Clone or download this repository
2. Make the script executable:
```bash
chmod +x forge
```
3. Optionally, move it to a directory in your PATH:
```bash
2025-11-21 19:45:32 +05:30
sudo mv forge /usr/local/bin/forge
2025-11-19 22:42:28 +05:30
```
## Quick Start
```bash
# Initialize the configuration structure
./forge init
2025-11-21 19:45:32 +05:30
# Edit the configuration file to add packages and dotfiles
nano ~/.config/forge/forge.toml
2025-11-19 22:42:28 +05:30
# Apply configuration
./forge switch
2025-11-21 19:45:32 +05:30
# Check status
./forge status
2025-11-19 22:42:28 +05:30
```
## Commands
### `init`
2025-11-21 19:45:32 +05:30
Initialize the configuration structure and create `forge.toml`.
2025-11-19 22:42:28 +05:30
```bash
./forge init
```
Creates:
2025-11-21 19:45:32 +05:30
- `~/.config/forge/` - Main configuration directory
- `~/.config/forge/forge.toml` - Central configuration file
2025-11-19 22:42:28 +05:30
### `switch`
2025-11-21 20:22:02 +05:30
Apply the current configuration (enable COPR, install packages, deploy dotfiles).
2025-11-19 22:42:28 +05:30
```bash
./forge switch
```
This command:
2025-11-21 20:22:02 +05:30
1. Enables all COPR repositories listed in `forge.toml`
2. Disables COPR repositories that are no longer configured
3. Installs all packages listed in `forge.toml`
4. Creates symlinks for all configured dotfiles
5. Creates backups of existing files before replacing them
6. Updates the last switch timestamp
2025-11-19 22:42:28 +05:30
### `status`
2025-11-21 19:45:32 +05:30
Show current configuration status and information.
2025-11-19 22:42:28 +05:30
```bash
./forge status
```
Displays:
- Configuration directory paths
- Last switch timestamp
2025-11-21 20:22:02 +05:30
- List of configured COPR repositories, packages and dotfiles
2025-11-19 22:42:28 +05:30
### `help`
Show help message with all available commands.
```bash
./forge help
```
2025-11-21 19:45:32 +05:30
## Configuration
### forge.toml
The central configuration file located at `~/.config/forge/forge.toml`:
2025-11-19 22:42:28 +05:30
2025-11-20 17:17:08 +05:30
```toml
2025-11-21 19:45:32 +05:30
# Forge Configuration File
# User-level configuration similar to home-manager/nixos
[forge]
version = "1.0"
last_switch = null
2025-11-20 17:17:08 +05:30
2025-11-21 20:22:02 +05:30
[copr]
# COPR repositories to enable
# Just list COPR repository names - presence means enable, absence means don't enable
copr.fedorainfracloud.org/username/repository
copr.fedorainfracloud.org/anotheruser/anotherrepo
2025-11-20 17:17:08 +05:30
[packages]
2025-11-21 19:45:32 +05:30
# List of packages to install using dnf
2025-11-21 20:01:07 +05:30
# Just list package names - presence means install, absence means don't install
git
vim
curl
wget
2025-11-21 19:45:32 +05:30
[dotfiles]
# Dotfiles to manage with symlinks
# Format: "target_path" = "source_path"
# target_path: where the symlink should be created (relative to home directory)
2025-12-19 20:13:03 +05:30
# source_path: where the actual file is stored (relative to dotfiles directory)
".bashrc" = ".bashrc"
".config/vimrc" = "vimrc"
".config/alacritty/alacritty.yml" = "alacritty.yml"
2025-11-21 19:45:32 +05:30
[options]
# Additional options
backup = true
backup_dir = "backup"
```
### Configuration Sections
#### `[forge]`
- `version`: Configuration file version
- `last_switch`: Timestamp of last switch operation (auto-updated)
2025-11-21 20:22:02 +05:30
#### `[copr]`
List of COPR repositories to enable via `dnf copr enable`. **Just list COPR repository names** - presence means enable, absence means don't enable.
**Examples:**
```toml
[copr]
copr.fedorainfracloud.org/username/repository
copr.fedorainfracloud.org/anotheruser/anotherrepo
```
To remove a COPR repository, simply delete the line containing the repository name. Forge will automatically disable it during the next switch.
2025-11-21 19:45:32 +05:30
#### `[packages]`
2025-11-21 20:01:07 +05:30
List of packages to install via dnf. **Just list package names** - presence means install, absence means don't install.
**Examples:**
```toml
[packages]
git
vim
curl
wget
nodejs
npm
```
To remove a package, simply delete the line containing the package name.
2025-11-21 19:45:32 +05:30
#### `[dotfiles]`
Dotfile mappings using symlinks:
- **Key**: Target path where symlink should be created (relative to home directory)
2025-12-19 20:13:03 +05:30
- **Value**: Source path where actual file is stored (relative to dotfiles directory)
- Note: Source path automatically prefixed with "dotfiles/" if not present
2025-11-21 19:45:32 +05:30
#### `[options]`
Additional configuration options:
- `backup`: Enable/disable backup of existing files (default: true)
- `backup_dir`: Directory name for backups (relative to forge directory)
2025-11-19 22:42:28 +05:30
2025-11-21 19:45:32 +05:30
## File Structure
2025-11-19 22:42:28 +05:30
```
2025-11-21 19:45:32 +05:30
~/.config/forge/
├── forge.toml # Main configuration file
├── dotfiles/ # Your actual dotfiles (source files)
│ ├── .bashrc
│ ├── vimrc
│ └── alacritty.yml
└── backup/ # Backups of replaced files
├── .bashrc.20231121_143022.bak
└── vimrc.20231121_143022.bak
2025-11-19 22:42:28 +05:30
```
2025-11-21 19:45:32 +05:30
## How It Works
2025-11-19 22:42:28 +05:30
2025-11-21 20:22:02 +05:30
### COPR Repository Management
COPR repositories are managed through the `[copr]` section in `forge.toml`:
- **Add COPR repo**: Simply add the repository name on a new line
- **Remove COPR repo**: Delete the line containing the repository name
- **Automatic cleanup**: Forge automatically disables COPR repos that are removed from configuration
- **No flags needed**: Just presence/absence of the repository name matters
2025-11-21 20:01:07 +05:30
### Package Management
Packages are managed through the `[packages]` section in `forge.toml`:
- **Add package**: Simply add the package name on a new line
- **Remove package**: Delete the line containing the package name
- **No flags needed**: Just presence/absence of the package name matters
2025-11-21 19:45:32 +05:30
### Dotfile Management
Forge uses symlinks to manage dotfiles:
1. Your actual dotfiles are stored in `~/.config/forge/dotfiles/`
2025-12-19 20:13:03 +05:30
2. Symlinks are created from your home directory to these files using relative paths
2025-11-21 19:45:32 +05:30
3. This allows you to version control your dotfiles in one place
4. Changes to the source files are immediately reflected in your home directory
2025-12-19 20:13:03 +05:30
5. Source paths are automatically prefixed with "dotfiles/" for convenience
2025-11-19 22:42:28 +05:30
### Backup System
2025-11-21 19:45:32 +05:30
Before creating symlinks, Forge:
1. Checks if the target file exists and is not a symlink
2. Creates a timestamped backup in the backup directory
3. Removes the original file
4. Creates the symlink to your managed dotfile
2025-11-19 22:42:28 +05:30
## Examples
### Basic Setup
```bash
2025-11-21 19:45:32 +05:30
# Initialize forge
2025-11-19 22:42:28 +05:30
./forge init
2025-11-21 20:22:02 +05:30
# Edit forge.toml to add COPR repos and packages
2025-11-21 19:45:32 +05:30
nano ~/.config/forge/forge.toml
2025-11-21 20:22:02 +05:30
# Add to [copr] section:
copr.fedorainfracloud.org/username/cool-repo
2025-11-21 19:45:32 +05:30
# Add to [packages] section:
2025-11-21 20:01:07 +05:30
git
vim
curl
# Create your dotfiles directory and add files
mkdir -p ~/.config/forge/dotfiles
echo "export EDITOR=vim" > ~/.config/forge/dotfiles/.bashrc
2025-11-21 19:45:32 +05:30
# Add to [dotfiles] section:
2025-12-19 20:13:03 +05:30
".bashrc" = ".bashrc"
2025-11-19 22:42:28 +05:30
# Apply configuration
./forge switch
```
2025-11-21 19:45:32 +05:30
### Managing Application Configurations
2025-11-19 22:42:28 +05:30
```bash
2025-11-21 19:45:32 +05:30
# Add alacritty configuration
2025-12-19 20:13:03 +05:30
mkdir -p ~/.config/forge/dotfiles
cp ~/.config/alacritty/alacritty.yml ~/.config/forge/dotfiles/
2025-11-21 19:45:32 +05:30
# Edit forge.toml
nano ~/.config/forge/forge.toml
2025-11-19 22:42:28 +05:30
2025-11-21 19:45:32 +05:30
# Add to [dotfiles] section:
2025-12-19 20:13:03 +05:30
".config/alacritty/alacritty.yml" = "alacritty.yml"
2025-11-19 22:42:28 +05:30
# Apply changes
./forge switch
```
2025-11-21 20:22:02 +05:30
### COPR Repository Management Examples
```toml
[copr]
# Development tools COPR
copr.fedorainfracloud.org/development/tools
copr.fedorainfracloud.org/user/neovim-nightly
# To remove a COPR repo, just delete the line
# Forge will automatically disable it during the next switch
```
2025-11-21 20:01:07 +05:30
### Package Management Examples
```toml
[packages]
# Development tools
git
vim
nodejs
npm
# System utilities
curl
wget
tree
htop
# To remove a package, just delete the line
# For example, to remove htop, delete the "htop" line
```
2025-11-21 19:45:32 +05:30
### Version Control Your Configuration
2025-11-19 22:42:28 +05:30
```bash
2025-11-21 19:45:32 +05:30
# Initialize git repository in forge directory
cd ~/.config/forge
git init
git add .
git commit -m "Initial configuration"
# Now you can version control your entire system configuration
git add forge.toml dotfiles/
git commit -m "Updated vim configuration"
2025-11-19 22:42:28 +05:30
```
2025-11-21 19:45:32 +05:30
## Environment Variables
2025-11-19 22:42:28 +05:30
2025-11-21 19:45:32 +05:30
- `FORGE_DIR`: Override the default configuration directory (default: `~/.config/forge`)
## Dependencies
- `dnf` - Fedora package manager
2025-11-21 20:22:02 +05:30
- `dnf-plugins-core` - For COPR repository management
2025-11-21 19:45:32 +05:30
- `sed` - For updating configuration file (usually pre-installed)
## Migration from Previous Version
2025-11-21 20:01:07 +05:30
If you were using the old version of forge with `git = true` format:
2025-11-21 19:45:32 +05:30
1. Your existing configuration will not be automatically migrated
2. Run `./forge init` to create the new `forge.toml` structure
2025-11-21 20:01:07 +05:30
3. Convert your package configuration from:
```toml
# Old format
git = true
vim = true
```
to:
```toml
# New format
git
vim
```
2025-11-21 19:45:32 +05:30
4. Move your existing dotfiles from the old directory to `~/.config/forge/dotfiles/`
2025-11-19 22:42:28 +05:30
## License
This project is open source. Feel free to contribute or report issues.