added env var support

This commit is contained in:
randogoth 2026-01-01 20:21:38 +02:00
parent 7d51de1052
commit 25c80fdf3b
3 changed files with 390 additions and 10 deletions

View file

@ -66,8 +66,9 @@ This command:
2. Disables COPR repositories that are no longer configured
3. Installs all packages listed in `inventory.toml`
4. Creates symlinks for all configured dotfiles
5. Creates backups of existing files before replacing them
6. Updates the last switch timestamp
5. Applies environment variables to `~/.config/environment.d/20-curator.conf` and imports them into the user session
6. Creates backups of existing files before replacing them
7. Updates the last switch timestamp
### `status`
Show current configuration status and information.
@ -117,6 +118,15 @@ Remove the rollback snapshot (`inventory.toml.rollback`).
curator reset
```
### `env`
Apply environment variables defined in `[variables]` and propagate them to systemd/DBus. For your current shell, run:
```bash
curator env
# then, to update this shell:
eval "$(curator env --eval)"
```
## Configuration
### inventory.toml
@ -156,6 +166,10 @@ last_switch = ""
# nixpkgs#git # or just "git" (curator will prefix nixpkgs#)
# nixpkgs#htop # or just "htop"
[variables]
# ENV_VAR = "value"
# ANOTHER = "another value"
[dotfiles]
# Dotfiles to manage with symlinks
# Format: "target_path" = "source_path"
@ -217,6 +231,21 @@ List of rpm-ostree layered packages. **One package per line**—presence means i
#### `[nix]`
List of nix packages. **One package per line**—presence means install. You can specify plain names (e.g., `neovim`) or `nixpkgs#name`; curator will prefix `nixpkgs#` for installs and use the base name for removals.
#### `[variables]`
User environment variables to set via systemd `environment.d`. curator writes them to `~/.config/environment.d/20-curator.conf` during `curator switch`; new sessions will load them automatically.
**Examples:**
```toml
[variables]
EDITOR = "nvim"
PAGER = "less -R"
```
Notes:
- Values are imported into the user systemd and DBus environments during `curator switch` or `curator env`.
- To update a currently running shell, run `eval "$(curator env --eval)"` after applying.
- Later shell init files (e.g., `.bashrc`, `.zshrc`) can still override these values.
#### `[dotfiles]`
Dotfile mappings using symlinks:
- **Key**: Target path where symlink should be created (relative to home directory)
@ -244,4 +273,4 @@ Additional configuration options:
## Environment Variables
- `CURATOR_DIR`: Override the default configuration directory (default: `~/.config/curator`)
- `CURATOR_DIR`: Override the default configuration directory (default: `~/.config/curator`)