35 lines
1.4 KiB
Markdown
35 lines
1.4 KiB
Markdown
# AGENTS.md - NixOS Configuration Repository
|
|
|
|
## Build/Test Commands
|
|
```bash
|
|
# Validate configuration syntax
|
|
nix flake check
|
|
|
|
# Dry-run build for specific host (test without building)
|
|
nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel --dry-run
|
|
|
|
# Test configuration without switching
|
|
sudo nixos-rebuild test --flake .
|
|
|
|
# Apply configuration changes
|
|
sudo nixos-rebuild switch --flake .#<hostname>
|
|
```
|
|
|
|
## Code Style Guidelines
|
|
|
|
**Language**: Nix expression language
|
|
|
|
**Formatting**: Use 2-4 space indentation (varies by file), no tabs except in some user modules
|
|
|
|
**Imports**: Always import required modules at top: `{ config, lib, pkgs, ... }:` or with additional args like `inputs, outputs, system, timeZone`
|
|
|
|
**Naming**: Use camelCase for options (`userName`, `hostName`, `isDesktopUser`), kebab-case for hostnames, underscores for module names (`main_user`)
|
|
|
|
**Module Pattern**: Define options with `lib.mkOption`, use `lib.mkIf` for conditional config, use `lib.mkMerge` for combining attribute sets
|
|
|
|
**Error Handling**: Rely on Nix's built-in evaluation errors; use `lib.mkEnableOption` for optional features
|
|
|
|
**Types**: Specify types in options: `lib.types.str`, `lib.types.bool`, provide defaults and descriptions for all options
|
|
|
|
**Comments**: Minimal comments; prefer self-documenting option descriptions; hardware files auto-generated with warnings at top
|