Cleaner Readme
This commit is contained in:
parent
6d7037866a
commit
56a8b8ff87
2 changed files with 286 additions and 193 deletions
223
Documentation/main.md
Normal file
223
Documentation/main.md
Normal file
|
|
@ -0,0 +1,223 @@
|
||||||
|
# Documentation
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
| Tool / Service | Required | Notes |
|
||||||
|
| -------------------- | -------- | -------------------------------------------------------- |
|
||||||
|
| NixOS / Nix | ✅ | Nyx is designed for NixOS or compatible Nix environments |
|
||||||
|
| `sudo` access | ✅ | Needed for system-level operations |
|
||||||
|
| Home Manager | ✅ | Integrates via `home.nix` |
|
||||||
|
| Git | ✅ | Required for `autoPush*` features (must be a Git repo) |
|
||||||
|
| `nix-output-monitor` | ✅ | Automatically provided by Nyx |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
Nyx-Tools
|
||||||
|
├── nyx
|
||||||
|
│ ├── bash
|
||||||
|
│ │ ├── nyx-cleanup.sh
|
||||||
|
│ │ ├── nyx-rebuild.sh
|
||||||
|
│ │ ├── nyx-tool.sh
|
||||||
|
│ │ └── nyx-tui.sh
|
||||||
|
│ ├── default.nix
|
||||||
|
│ ├── nyx-cleanup.nix
|
||||||
|
│ ├── nyx-rebuild.nix
|
||||||
|
│ ├── nyx-tool.nix
|
||||||
|
│ └── nyx-tui.nix
|
||||||
|
└── other/
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
* **`default.nix`**
|
||||||
|
Importing the other Modules.
|
||||||
|
|
||||||
|
* **`nyx-tool.nix`**
|
||||||
|
Sets up shell visuals (e.g. banners) and Zsh helpers.
|
||||||
|
|
||||||
|
* **`nyx-rebuild.nix`**
|
||||||
|
Enhances `nixos-rebuild` with:
|
||||||
|
|
||||||
|
* Git auto-push support
|
||||||
|
* Optional code formatting before builds
|
||||||
|
* Rebuild logging
|
||||||
|
|
||||||
|
* **`nyx-cleanup.nix`**
|
||||||
|
Automates system cleanup and tracks logs (optionally pushes to GitHub).
|
||||||
|
|
||||||
|
* **`nyx-tui.nix`**
|
||||||
|
Making a TUI for the other tools.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### 1. Add Nyx to your Flake
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# flake.nix
|
||||||
|
{
|
||||||
|
inputs.nyx.url = "github:Peritia-System/Nyx-Tools";
|
||||||
|
|
||||||
|
outputs = inputs @ { nixpkgs, nyx, ... }:
|
||||||
|
{
|
||||||
|
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [ ./configuration.nix ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Import Nyx into Home Manager
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# home.nix
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.nyx.homeManagerModules.default
|
||||||
|
];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Enable Desired Modules
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
nyx = {
|
||||||
|
|
||||||
|
enable = true;
|
||||||
|
inherit username nixDirectory;
|
||||||
|
logDir = "/home/${username}/.nyx/logs";
|
||||||
|
autoPush = false;
|
||||||
|
|
||||||
|
nyx-rebuild = {
|
||||||
|
enable = true;
|
||||||
|
editor = "nvim";
|
||||||
|
formatter = "alejandra";
|
||||||
|
enableAlias = false;
|
||||||
|
startEditor = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
nyx-cleanup = {
|
||||||
|
enable = true;
|
||||||
|
keepGenerations = 5;
|
||||||
|
enableAlias = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
nyx-tool = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
nyx-tui = {
|
||||||
|
enable = true;
|
||||||
|
enableAlias = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Note**: `nixDirectory` must be a **full path** to your flake repo (e.g., `/home/${username}/NixOS/Nyx-Tools`).
|
||||||
|
|
||||||
|
See `other/example/example-home.nix` for a working example.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# to just do a simple rebuild you can:
|
||||||
|
nyx-rebuild
|
||||||
|
|
||||||
|
# to see the available options:
|
||||||
|
$ nyx-rebuild -h
|
||||||
|
nyx-rebuild [--repair] [--update]
|
||||||
|
|
||||||
|
--repair Stage & commit the nix_dir with "rebuild - repair <timestamp>"
|
||||||
|
and remove any unfinished logs (Current-Error*.txt and rebuild-*.log
|
||||||
|
that are not final nixos-gen_* logs).
|
||||||
|
|
||||||
|
--update Before rebuilding, update the flake in nix_dir using:
|
||||||
|
nix flake update
|
||||||
|
|
||||||
|
# to cleanup old configurations:
|
||||||
|
nyx-cleanup
|
||||||
|
|
||||||
|
# And to see the other options:
|
||||||
|
nyx-cleanup -h
|
||||||
|
nyx-cleanup [--dry-run] [--keep N]
|
||||||
|
|
||||||
|
Prunes old *system* generations, runs GC (and store optimise), and tidies logs.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--dry-run Show actions without doing them.
|
||||||
|
--keep N Override configured generations to keep (default: 5).
|
||||||
|
-h, --help Show this help.
|
||||||
|
|
||||||
|
|
||||||
|
# For nyx-tui run simply
|
||||||
|
nyx-tui
|
||||||
|
|
||||||
|
# or for a small startup animation
|
||||||
|
nyx-tui --pretty
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Module Options
|
||||||
|
|
||||||
|
### `nyx.nyx-rebuild`
|
||||||
|
|
||||||
|
| Option | Description | Default |
|
||||||
|
| ------------------ | -------------------------------------- | ------------------------- |
|
||||||
|
| `enable` | Enable the module | `false` |
|
||||||
|
| `startEditor` | Launch editor before rebuilding | `false` |
|
||||||
|
| `editor` | Editor to use (`vim`, `nvim`, etc.) | — |
|
||||||
|
| `enableFormatting` | Auto-format Nix files before rebuild | `false` |
|
||||||
|
| `formatter` | Formatter to use (e.g., `alejandra`) | — |
|
||||||
|
| `enableAlias` | Add CLI alias for rebuild | `false` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `nyx.nyx-cleanup`
|
||||||
|
|
||||||
|
| Option | Description | Default |
|
||||||
|
| ----------------- | ----------------------------- | ------------------------- |
|
||||||
|
| `enable` | Enable the module | `false` |
|
||||||
|
| `keepGenerations` | Number of generations to keep | `5` |
|
||||||
|
| `enableAlias` | Add CLI alias for cleanup | `false` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `nyx.nyx-tui`
|
||||||
|
|
||||||
|
| Option | Description | Default |
|
||||||
|
| ----------------- | ----------------------------- | ------------------------- |
|
||||||
|
| `enable` | Enable the module | `false` |
|
||||||
|
| `enableAlias` | Add CLI alias for the tui | `false` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `nyx.nyx-tool`
|
||||||
|
|
||||||
|
| Option | Description | Default |
|
||||||
|
| -------- | ------------------------------- | ------- |
|
||||||
|
| `enable` | Enables banners and shell tools | `false` |
|
||||||
|
|
||||||
|
> 💡 `nyx-tool` must be enabled for other modules to function properly.
|
||||||
|
|
||||||
250
README.md
250
README.md
|
|
@ -1,85 +1,41 @@
|
||||||
# Nyx: NixOS System Management Toolkit
|
Nyx — NixOS System Management Toolkit
|
||||||
|
|
||||||
**Nyx** is a modular toolkit that simplifies and automates various NixOS system management tasks, from enhanced rebuilds to cleanup and shell customization.
|
**Nyx** is a modular toolkit that makes managing NixOS easier — faster rebuilds, automated cleanup, shell customization, and an optional TUI interface.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* **Enhanced NixOS Rebuilds** — via `nyx-rebuild.nix`
|
* **Enhanced Rebuilds** — Git auto-push, optional formatting, rebuild logs
|
||||||
* **Automated System Cleanup** — via `nyx-cleanup.nix`
|
* **Automated Cleanup** — prune old generations, GC, optimize store
|
||||||
* **Shell Customization & Tooling** — banners and helpers via `nyx-tool.nix`
|
* **Shell Tools** — banners, helpers, aliases
|
||||||
* **All-in-One Integration** — enable everything with a single import: `nyx.nix`
|
* **TUI Interface** — simple, pretty menu for all Nyx tools
|
||||||
|
* **One Import to Enable All** — `nyx.nix`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Dependencies
|
## Requirements
|
||||||
|
|
||||||
| Tool / Service | Required | Notes |
|
| Tool / Service | Required | Notes |
|
||||||
| -------------------- | -------- | -------------------------------------------------------- |
|
| -------------------- | -------- | -------------------------------- |
|
||||||
| NixOS / Nix | ✅ | Nyx is designed for NixOS or compatible Nix environments |
|
| NixOS / Nix | ✅ | Core platform |
|
||||||
| `sudo` access | ✅ | Needed for system-level operations |
|
| `sudo` | ✅ | Needed for system changes |
|
||||||
| Home Manager | ✅ | Integrates via `home.nix` |
|
| Home Manager | ✅ | For integration |
|
||||||
| Git | ✅ | Required for `autoPush*` features (must be a Git repo) |
|
| Git | ✅ | Required for `autoPush` features |
|
||||||
| `nix-output-monitor` | ✅ | Automatically provided by Nyx |
|
| `nix-output-monitor` | ✅ | Installed automatically by Nyx |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Project Structure
|
## Quick Install
|
||||||
|
|
||||||
```
|
### 1. Add Nyx to your flake
|
||||||
Nyx-Tools
|
|
||||||
├── nyx
|
|
||||||
│ ├── bash
|
|
||||||
│ │ ├── nyx-cleanup.sh
|
|
||||||
│ │ ├── nyx-rebuild.sh
|
|
||||||
│ │ ├── nyx-tool.sh
|
|
||||||
│ │ └── nyx-tui.sh
|
|
||||||
│ ├── default.nix
|
|
||||||
│ ├── nyx-cleanup.nix
|
|
||||||
│ ├── nyx-rebuild.nix
|
|
||||||
│ ├── nyx-tool.nix
|
|
||||||
│ └── nyx-tui.nix
|
|
||||||
└── other/
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## How It Works
|
|
||||||
|
|
||||||
* **`default.nix`**
|
|
||||||
Importing the other Modules.
|
|
||||||
|
|
||||||
* **`nyx-tool.nix`**
|
|
||||||
Sets up shell visuals (e.g. banners) and Zsh helpers.
|
|
||||||
|
|
||||||
* **`nyx-rebuild.nix`**
|
|
||||||
Enhances `nixos-rebuild` with:
|
|
||||||
|
|
||||||
* Git auto-push support
|
|
||||||
* Optional code formatting before builds
|
|
||||||
* Rebuild logging
|
|
||||||
|
|
||||||
* **`nyx-cleanup.nix`**
|
|
||||||
Automates system cleanup and tracks logs (optionally pushes to GitHub).
|
|
||||||
|
|
||||||
* **`nyx-tui.nix`**
|
|
||||||
Making a TUI for the other tools.
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
### 1. Add Nyx to your Flake
|
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
# flake.nix
|
# flake.nix
|
||||||
{
|
{
|
||||||
inputs.nyx.url = "github:Peritia-System/Nyx-Tools";
|
inputs.nyx.url = "github:Peritia-System/Nyx-Tools";
|
||||||
|
|
||||||
outputs = inputs @ { nixpkgs, nyx, ... }:
|
outputs = inputs @ { nixpkgs, nyx, ... }: {
|
||||||
{
|
|
||||||
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
|
||||||
modules = [ ./configuration.nix ];
|
modules = [ ./configuration.nix ];
|
||||||
};
|
};
|
||||||
|
|
@ -87,175 +43,89 @@ Nyx-Tools
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Import Nyx into Home Manager
|
### 2. Import in Home Manager
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
# home.nix
|
# home.nix
|
||||||
{
|
{
|
||||||
config,
|
imports = [ inputs.nyx.homeManagerModules.default ];
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
inputs.nyx.homeManagerModules.default
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Enable Desired Modules
|
### 3. Enable modules
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
nyx = {
|
||||||
nyx = {
|
|
||||||
|
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit username nixDirectory;
|
username = "alex";
|
||||||
logDir = "/home/${username}/.nyx/logs";
|
nixDirectory = "/home/alex/NixOS"; # full path to flake repo
|
||||||
|
logDir = "/home/alex/.nyx/logs";
|
||||||
autoPush = false;
|
autoPush = false;
|
||||||
|
|
||||||
nyx-rebuild = {
|
nyx-tool.enable = true; # must be enabled for others
|
||||||
enable = true;
|
nyx-rebuild.enable = true;
|
||||||
editor = "nvim";
|
nyx-cleanup.enable = true;
|
||||||
formatter = "alejandra";
|
nyx-tui.enable = true;
|
||||||
enableAlias = false;
|
};
|
||||||
startEditor = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
nyx-cleanup = {
|
|
||||||
enable = true;
|
|
||||||
keepGenerations = 5;
|
|
||||||
enableAlias = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
nyx-tool = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nyx-tui = {
|
|
||||||
enable = true;
|
|
||||||
enableAlias = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> ⚠️ **Note**: `nixDirectory` must be a **full path** to your flake repo (e.g., `/home/${username}/NixOS/Nyx-Tools`).
|
|
||||||
|
|
||||||
See `other/example/example-home.nix` for a working example.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 4. Rebuild and you can use it:
|
## Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# to just do a simple rebuild you can:
|
nyx-rebuild --update # Update flake + rebuild
|
||||||
nyx-rebuild
|
nyx-rebuild --repair # Repair and clean unfinished logs
|
||||||
|
|
||||||
# to see the available options:
|
|
||||||
$ nyx-rebuild -h
|
|
||||||
nyx-rebuild [--repair] [--update]
|
|
||||||
|
|
||||||
--repair Stage & commit the nix_dir with "rebuild - repair <timestamp>"
|
|
||||||
and remove any unfinished logs (Current-Error*.txt and rebuild-*.log
|
|
||||||
that are not final nixos-gen_* logs).
|
|
||||||
|
|
||||||
--update Before rebuilding, update the flake in nix_dir using:
|
|
||||||
nix flake update
|
|
||||||
|
|
||||||
# to cleanup old configurations:
|
|
||||||
nyx-cleanup
|
|
||||||
|
|
||||||
# And to see the other options:
|
|
||||||
nyx-cleanup -h
|
|
||||||
nyx-cleanup [--dry-run] [--keep N]
|
|
||||||
|
|
||||||
Prunes old *system* generations, runs GC (and store optimise), and tidies logs.
|
|
||||||
|
|
||||||
Options:
|
|
||||||
--dry-run Show actions without doing them.
|
|
||||||
--keep N Override configured generations to keep (default: 5).
|
|
||||||
-h, --help Show this help.
|
|
||||||
|
|
||||||
|
|
||||||
# For nyx-tui run simply
|
|
||||||
nyx-tui
|
|
||||||
|
|
||||||
# or for a small startup animation
|
|
||||||
nyx-tui --pretty
|
|
||||||
|
|
||||||
|
nyx-cleanup # Remove old generations + GC
|
||||||
|
nyx-cleanup --dry-run # Preview cleanup
|
||||||
|
|
||||||
|
nyx-tui # Launch TUI
|
||||||
|
nyx-tui --pretty # TUI with animation
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Showcase
|
---
|
||||||
|
|
||||||
|
## Showcase
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>nyx-tui</summary>
|
<summary>nyx-tui</summary>
|
||||||
[Video](other/Ressources/showcase.mp4)
|
|
||||||
|
<video src="other/Ressources/showcase.mp4" controls autoplay loop muted width="640">
|
||||||
|
Your browser does not support the video tag.
|
||||||
|
</video>
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Module Options
|
## Module Options
|
||||||
|
|
||||||
### `nyx.nyx-rebuild`
|
| Module | Key Options |
|
||||||
|
| ------------- | ----------------------------------------- |
|
||||||
| Option | Description | Default |
|
| `nyx-rebuild` | `startEditor`, `formatter`, `enableAlias` |
|
||||||
| ------------------ | -------------------------------------- | ------------------------- |
|
| `nyx-cleanup` | `keepGenerations`, `enableAlias` |
|
||||||
| `enable` | Enable the module | `false` |
|
| `nyx-tui` | `enableAlias` |
|
||||||
| `startEditor` | Launch editor before rebuilding | `false` |
|
| `nyx-tool` | Shell banners & helpers (base req) |
|
||||||
| `editor` | Editor to use (`vim`, `nvim`, etc.) | — |
|
|
||||||
| `enableFormatting` | Auto-format Nix files before rebuild | `false` |
|
|
||||||
| `formatter` | Formatter to use (e.g., `alejandra`) | — |
|
|
||||||
| `enableAlias` | Add CLI alias for rebuild | `false` |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### `nyx.nyx-cleanup`
|
## Tips
|
||||||
|
|
||||||
| Option | Description | Default |
|
* `nyx-tool` **must be enabled** for other modules.
|
||||||
| ----------------- | ----------------------------- | ------------------------- |
|
* `nixDirectory` must be a full Git repo path for `autoPush` to work.
|
||||||
| `enable` | Enable the module | `false` |
|
* See `other/example/example-home.nix` for a full working setup.
|
||||||
| `keepGenerations` | Number of generations to keep | `5` |
|
|
||||||
| `enableAlias` | Add CLI alias for cleanup | `false` |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### `nyx.nyx-tui`
|
## More Info
|
||||||
|
|
||||||
|
refer to: **[Documentaion](./Documentation/main.md)**
|
||||||
|
|
||||||
| Option | Description | Default |
|
|
||||||
| ----------------- | ----------------------------- | ------------------------- |
|
|
||||||
| `enable` | Enable the module | `false` |
|
|
||||||
| `enableAlias` | Add CLI alias for the tui | `false` |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### `nyx.nyx-tool`
|
|
||||||
|
|
||||||
| Option | Description | Default |
|
|
||||||
| -------- | ------------------------------- | ------- |
|
|
||||||
| `enable` | Enables banners and shell tools | `false` |
|
|
||||||
|
|
||||||
> 💡 `nyx-tool` must be enabled for other modules to function properly.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
You're welcome to contribute:
|
|
||||||
|
|
||||||
* New features & modules
|
|
||||||
* Tooling improvements
|
|
||||||
* Bug fixes or typos
|
|
||||||
|
|
||||||
Open an issue or pull request at:
|
|
||||||
|
|
||||||
👉 [https://github.com/Peritia-System/Nyx-Tools](https://github.com/Peritia-System/Nyx-Tools)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
Licensed under the [MIT License](./LICENSE)
|
|
||||||
|
|
||||||
|
## 📜 License
|
||||||
|
[MIT](./LICENSE) — Contributions welcome!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue