# AGENTS.md - Guidelines for Agentic Coding in Azos This is a NixOS/Nix flake-based configuration repository using home-manager for dotfiles and system configuration. ## Build Commands ### Evaluating ```bash nix eval .#nixosConfigurations.lauretta.config.system.build.toplevel nix flake show ``` ### Building ```bash # VM (with submodules for azos-core) nix build '.?submodules=1#nixosConfigurations.vm.config.system.build.vm' # Formatter nix build .#formatter.x86_64-linux ``` ### Deploying ```bash # Rebuild the azos environment for lauretta (this machine) — use this when asked to "rebuild" sudo nixos-rebuild switch --flake '.?submodules=1#lauretta' nix flake update --flake '.?submodules=1' # Update all inputs nix flake lock --flake '.?submodules=1' --update-input X # Update specific input ``` > **Note**: When the user asks to "rebuild", they mean rebuilding the lauretta environment with the command above — NOT building the VM. ### Dev Shell & REPL ```bash nix develop .#shells.x86_64-linux.default nix repl :lf . ``` ### Ad-hoc Commands If an executable doesn't exist on the system, run it ad-hoc with: ```bash nix shell nixpkgs# --command ``` ## Linting/Formatting Uses [alejandra](https://github.com/kamadorama/alejandra): ```bash nix fmt # Format all Nix files alejandra . ``` ## Testing Manual VM testing: ```bash nix build '.?submodules=1#nixosConfigurations.vm.config.system.build.vm' ./result/bin/run-nixos-vm ``` ## Emacs Debugging When adding or debugging Emacs functionality, you can interact with the running Emacs session via `emacsclient` (with user permission): ```bash # Create and switch to a buffer emacsclient -c -e '(switch-to-buffer (get-buffer-create "test"))' # Evaluate arbitrary Elisp emacsclient -e '(message "hello")' ``` ## Repository Structure ``` azos/ ├── flake.nix # Main flake ├── home-manager/home.nix # Home-manager entry point; manually imports all modules ├── _machines/ # Per-machine NixOS configs (pass suiteModules as specialArgs) ├── nixos/ # NixOS system configs (configuration.nix, configuration-vm.nix, etc.) ├── features/ # Machine-specific home-manager features (auto-discovered) ├── overlays/ # Package overlays ├── shells/ # Dev shells └── azos-core/ # Shared feature library (git submodule) ├── flake.nix ├── features/ # Shared/reusable features (auto-discovered) ├── overlays/ # Core overlays └── _lib/ # Module schema helpers ``` Features are auto-discovered by `import-tree` — no central imports file. Each feature's `default.nix` registers itself via `config.flake.modules.homeManager.`. Modules are then explicitly imported in `home-manager/home.nix` via `suiteModules.homeManager.`. **Where to put a new feature:** - Shared / reusable across machines → `azos-core/features//default.nix` - Machine-specific → `azos/features//default.nix` ## Code Style Guidelines ### Nix Module Template All features follow this flake-parts registration pattern: ```nix {...}: { config.flake.modules.homeManager. = { lib, config, pkgs, ... }: { options.azos..enable = lib.mkOption { default = false; example = true; type = lib.types.bool; }; config = lib.mkIf config.azos..enable { home.packages = with pkgs; [pkg1 pkg2]; }; }; } ``` ### Naming Conventions - Option paths: `azos..