# Copilot Instructions for EmergentMind's Nix-Config ## Project Overview - This is a modular, flake-based NixOS configuration system, designed for multi-host, multi-user, and reproducible setups. - Major directories: - `hosts/`: Per-host NixOS configs (e.g., `hosts/nixos/Bellerophon/`). - `home/`: Per-user Home Manager configs. - `modules/`: Reusable NixOS and Home Manager modules, auto-imported via `lib.custom.scanPaths`. - `overlays/`, `pkgs/`: Custom packages and overlays. - `nixos-installer/`: Standalone flake for bootstrapping new hosts, with its own README and workflows. - `docs/`: Project documentation, including secrets management. - `scripts/`: Helper scripts for bootstrap, rebuild, sops, etc. ## Key Patterns & Conventions - **Imports**: Use `lib.custom.relativeToRoot` and `lib.custom.scanPaths` for DRY, recursive module imports. - **Host/Module Structure**: Each host and user has a directory with a `default.nix` as entrypoint. Common/optional configs are split for clarity. - **Disk Layout**: Disk setup is handled by `disko` modules, with per-host overrides for device and swap. - **Secrets**: Secrets are managed via a private `nix-secrets` repo and sops-nix. See `docs/secretsmgmt.md` and `nixos-installer/README.md` for details. - **VSCode/Language Support**: Language-specific VSCode configs live in `home/panotaka/common/optional/coding/vscode/languages/` and are imported via the main VSCode module. ## Developer Workflows - **Build & Rebuild**: Use `just rebuild` (runs pre/post hooks, see `justfile`). For full checks: `just rebuild-full` or `just check`. - **ISO Generation**: `just iso` builds a custom NixOS installer ISO. - **Secrets**: Use `just rekey`, `just sops-add-creation-rules`, and related commands for sops/age key management. - **Sync/Deploy**: Use `just sync` and `just build-host` for remote deployment. - **Testing**: Tests live in `tests/` and use `bats`. ## Integration Points - **External**: Relies on `nix-secrets` (private), sops-nix, disko, stylix, nix4vscode, and nixos-hardware modules. - **Cross-Component**: Host configs import common modules and optional features via mapped imports. Home Manager and NixOS modules are kept separate but coordinated. ## Examples - To add a new host: copy an existing host dir in `hosts/nixos/`, update disk and user settings, and add secrets as per `nixos-installer/README.md`. - To add a new language to VSCode: add a `.nix` file to `vscode/languages/` and import it in the main VSCode module. - To update secrets: run `just rekey` and follow the documented workflow. ## References - See `README.md`, `nixos-installer/README.md`, and `docs/secretsmgmt.md` for deep dives on architecture and workflows. - For module patterns, see `modules/` and `hosts/common/core/`. --- If you are unsure about a workflow or pattern, check the referenced docs or ask for clarification in your PR.