# โš™๏ธ 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. --- ## โœจ Features * ๐Ÿ” **Enhanced NixOS Rebuilds** โ€” via `nyx-rebuild.nix` * ๐Ÿงน **Automated System Cleanup** โ€” via `nyx-cleanup.nix` * ๐Ÿ› ๏ธ **Shell Customization & Tooling** โ€” banners and helpers via `nyx-tool.nix` * ๐Ÿงฉ **All-in-One Integration** โ€” enable everything with a single import: `nyx.nix` --- ## ๐Ÿ“ฆ 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 โ”œโ”€โ”€ default.nix # Top-level module โ”œโ”€โ”€ nyx-tool.nix # Shell enhancements and banners โ”œโ”€โ”€ nyx-rebuild.nix # Enhanced nixos-rebuild logic โ”œโ”€โ”€ nyx-cleanup.nix # System cleanup automation โ””โ”€โ”€ other/ # Legacy scripts (to be removed soon) ``` --- ## โš™๏ธ How It Works * **`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). --- ## ๐Ÿš€ 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.nyx-rebuild = { enable = true; inherit username nixDirectory; }; nyx.nyx-cleanup = { enable = true; inherit username nixDirectory; }; nyx.nyx-tool = { enable = true; inherit nixDirectory; }; } ``` > โš ๏ธ **Note**: `nixDirectory` must be a **full path** to your flake repo (e.g., `/home/${username}/NixOS/Nyx-Tools`). See `./other/example/home.nix` for a working example. --- ## ๐Ÿ”ง Module Options ### `modules.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` | | `autoPushLog` | Push rebuild logs to GitHub | `false` | | `autoPushNixDir` | Push flake dir to GitHub after rebuild | `false` | | `username` | Username the module applies to | Required | | `nixDirectory` | Full path to the Nix flake directory | Required | | `logDir` | Where to store logs | `~/.nyx/nyx-rebuild/logs` | --- ### `modules.nyx-cleanup` | Option | Description | Default | | ----------------- | ----------------------------- | ------------------------- | | `enable` | Enable the module | `false` | | `autoPush` | Push logs to GitHub | `false` | | `keepGenerations` | Number of generations to keep | `5` | | `enableAlias` | Add CLI alias for cleanup | `false` | | `username` | User this applies to | Required | | `nixDirectory` | Full path to flake dir | Required | | `logDir` | Path to store logs | `~/.nyx/nyx-cleanup/logs` | --- ### `modules.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)