Adding Importing functionality
This commit is contained in:
parent
62594d312c
commit
2f9ff34ad4
17 changed files with 1188 additions and 307 deletions
226
README.md
226
README.md
|
|
@ -1,6 +1,6 @@
|
|||
# ⚙️ Nyx: NixOS System Management Toolkit
|
||||
|
||||
**Nyx** is a modular toolkit for managing NixOS systems. It streamlines NixOS rebuilds, system cleanups, and developer workflow enhancements through a unified and extensible interface. Simply import one file to enable all features.
|
||||
**Nyx** is a modular toolkit that simplifies and automates various NixOS system management tasks, from enhanced rebuilds to cleanup and shell customization.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -8,152 +8,168 @@
|
|||
|
||||
* 🔁 **Enhanced NixOS Rebuilds** — via `nyx-rebuild.nix`
|
||||
* 🧹 **Automated System Cleanup** — via `nyx-cleanup.nix`
|
||||
* 🛠️ **Custom Shell Tools & Visuals** — like banners via `nyx-tool.nix`
|
||||
* 🧩 **One-File Integration** — import just `nyx.nix` to activate everything
|
||||
* 🛠️ **Shell Customization & Tooling** — banners and helpers via `nyx-tool.nix`
|
||||
* 🧩 **All-in-One Integration** — enable everything with a single import: `nyx.nix`
|
||||
|
||||
---
|
||||
|
||||
## 📦 Dependencies
|
||||
|
||||
* ✅ NixOS or compatible Nix environment
|
||||
* ✅ `sudo` access (for system operations)
|
||||
* ✅ [Home Manager](https://github.com/nix-community/home-manager)
|
||||
* ✅ Git — required if you use `autoPush` features (must be a Git repo)
|
||||
* ✅ Zsh (included via Nyx modules)
|
||||
* ✅ [`nix-output-monitor`](https://github.com/maralorn/nix-output-monitor) (included via Nyx)
|
||||
|
||||
> ℹ️ No need to preinstall Zsh or `nix-output-monitor`; Nyx provides them internally.
|
||||
| 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
|
||||
|
||||
```bash
|
||||
```
|
||||
Nyx-Tools
|
||||
├── nyx.nix # Master module
|
||||
├── nyx-tool.nix # Shell customizations (e.g., banners)
|
||||
├── default.nix # Top-level module
|
||||
├── nyx-tool.nix # Shell enhancements and banners
|
||||
├── nyx-rebuild.nix # Enhanced nixos-rebuild logic
|
||||
├── nyx-cleanup.nix # System cleanup logic
|
||||
└── zsh/
|
||||
├── nyx-cleanup.zsh
|
||||
├── nyx-rebuild.zsh
|
||||
└── nyx-tool.zsh
|
||||
````
|
||||
├── nyx-cleanup.nix # System cleanup automation
|
||||
└── other/ # Legacy scripts (to be removed soon)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ How It Works
|
||||
|
||||
* `nyx.nix`: Central module that imports all others.
|
||||
* `nyx-tool.nix`: Adds startup banners and sources Zsh helpers.
|
||||
* `nyx-rebuild.nix`: Extends `nixos-rebuild` with logs, Git push, and optional formatting.
|
||||
* `nyx-cleanup.nix`: Automates system cleanup and logs output.
|
||||
* `zsh/*.zsh`: Shell scripts sourced into Zsh to handle CLI tooling.
|
||||
* **`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. Import into `home.nix`
|
||||
### 1. Add Nyx to your Flake
|
||||
|
||||
```nix
|
||||
imports = [
|
||||
./path/to/Nyx-Tools/nyx.nix
|
||||
];
|
||||
# flake.nix
|
||||
{
|
||||
inputs.nyx.url = "github:Peritia-System/Nyx-Tools";
|
||||
|
||||
outputs = inputs @ { nixpkgs, nyx, ... }:
|
||||
{
|
||||
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
|
||||
modules = [ ./configuration.nix ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Enable desired modules
|
||||
### 2. Import Nyx into Home Manager
|
||||
|
||||
```nix
|
||||
modules.nyx-rebuild = {
|
||||
enable = true;
|
||||
inherit username nixDirectory;
|
||||
};
|
||||
|
||||
modules.nyx-cleanup = {
|
||||
enable = true;
|
||||
inherit username nixDirectory;
|
||||
};
|
||||
|
||||
modules.nix-tool = {
|
||||
enable = true;
|
||||
inherit nixDirectory;
|
||||
};
|
||||
# home.nix
|
||||
{
|
||||
imports = [
|
||||
inputs.nyx.homeManagerModules.default
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
> ⚠️ **Note:** You must define `nixDirectory` in your configuration or import it.
|
||||
> It must be a **full path** to your flake directory (e.g., `/home/${username}/NixOS/Nyx-Tools`).
|
||||
|
||||
👉 See the [example config](./EXAMPLE_home.nix) for a working setup.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Module Options
|
||||
|
||||
### `nyx-rebuild`
|
||||
|
||||
| Option | Description | Default |
|
||||
| ------------------ | ----------------------------------- | ------- |
|
||||
| `enable` | Enable this module | `false` |
|
||||
| `startEditor` | Launch an editor before rebuild | `false` |
|
||||
| `editor` | Which editor to use (`nvim`, `vim`) | — |
|
||||
| `enableFormatting` | Format Nix files before rebuild | `false` |
|
||||
| `formatter` | Formatter to use (`alejandra`) | — |
|
||||
| `enableAlias` | Add shell alias for rebuild | `false` |
|
||||
| `autoPush` | Push rebuild logs or dir to GitHub | `false` |
|
||||
|
||||
---
|
||||
|
||||
### `nyx-cleanup`
|
||||
|
||||
| Option | Description | Default |
|
||||
| ----------------- | ------------------------------------ | ------- |
|
||||
| `enable` | Enable this module | `false` |
|
||||
| `autoPush` | Push logs to GitHub after cleanup | `false` |
|
||||
| `keepGenerations` | Number of system generations to keep | `5` |
|
||||
| `enableAlias` | Add shell alias for cleanup | `false` |
|
||||
|
||||
---
|
||||
|
||||
### `nix-tool`
|
||||
|
||||
| Option | Description | Default |
|
||||
| -------- | ------------------ | ------- |
|
||||
| `enable` | Enable this module | `false` |
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Customization
|
||||
|
||||
Nyx is fully modular and extensible. You can:
|
||||
|
||||
* Modify existing `.nix` or `.zsh` files
|
||||
* Add new modules and source them in `nyx.nix`
|
||||
|
||||
### Example: Adding a Custom Tool
|
||||
### 3. Enable Desired Modules
|
||||
|
||||
```nix
|
||||
# Add to nyx.nix or your home.nix
|
||||
imports = [
|
||||
./nyx-rebuild.nix
|
||||
./my-custom-tool.nix
|
||||
];
|
||||
{
|
||||
nyx.nyx-rebuild = {
|
||||
enable = true;
|
||||
inherit username nixDirectory;
|
||||
};
|
||||
|
||||
nyx.nyx-cleanup = {
|
||||
enable = true;
|
||||
inherit username nixDirectory;
|
||||
};
|
||||
|
||||
nyx.nyx-tool = {
|
||||
enable = true;
|
||||
inherit nixDirectory;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Create `my-custom-tool.nix` and optionally pair it with a `.zsh` helper script in the `zsh/` folder.
|
||||
> ⚠️ **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
|
||||
|
||||
Contributions are welcome! Feel free to open an issue or submit a pull request to:
|
||||
You're welcome to contribute:
|
||||
|
||||
* Add new functionality
|
||||
* Improve existing tools
|
||||
* Fix bugs or typos
|
||||
* 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).
|
||||
Licensed under the [MIT License](./LICENSE)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue