4 KiB
Repository Guidelines
Project Structure & Module Organization
This repository is a declarative macOS setup built with Nix flakes, flake-parts,
and a dendritic aspect layout.
flake.nixandflake.lock: flake entrypoint and pinned inputs.modules/flake/: flake assembly, repo options, shared context modules, anddarwinConfigurationsgeneration.modules/aspects/: public aspect entry modules auto-discovered withimport-tree. Each aspect may exposeflake.modules.darwin.<feature>and/orrepo.homeModules.<feature>.modules/aspects/_*/: private implementation trees intentionally excluded fromimport-tree. Import these manually from the owning aspect to keep each feature plug-and-play and in control of its own composition surface.hosts/: auto-discovered host declarations that registerrepo.hosts.<hostname>.systemand a flatfeatureslist.secrets/and.sops.yaml: encrypted SOPS files and path rules.Justfile: day-to-day contributor commands.
Prefer adding a new focused aspect in modules/aspects/ and keeping host files
thin. Put reusable internals under a sibling _/ tree and wire them in
explicitly from the public aspect entry module.
Build, Test, and Development Commands
Use just as the primary interface:
just darwin <hostname>: build and switch to the current host (ex:fenrir).just darwin-debug <hostname>: same as above with verbose trace output.just fmt .: format Nix files from the repository root vianix fmt(Alejandra).just up: update all flake inputs.just upp <input>: update one input (example:just upp nixpkgs).just history,just clean,just gc: inspect and prune Nix generations/store.
For validation without switching, run:
nix build .#darwinConfigurations.fenrir.system --extra-experimental-features 'nix-command flakes'.
For dependency-graph validation without realizing a full build, run:
nix build .#darwinConfigurations.fenrir.system --dry-run --extra-experimental-features 'nix-command flakes'.
Coding Style & Naming Conventions
- Use 2-space indentation in
.nixfiles and keep attribute sets readable. - Run
just fmt .before committing; formatter is defined inflake.nix(alejandra). - Name aspect and helper files in lowercase kebab-case.
- Keep public aspect filenames aligned with the feature names referenced from
repo.hosts.<hostname>.features. - Keep host files declarative and small: they should select features, not carry large implementation blocks.
- Use
importsinside private_*/trees to compose internals, but expose the aspect itself through one public entry module inmodules/aspects/.
Testing Guidelines
There is no dedicated unit-test suite in this repo. Treat evaluation/build as the test gate:
- Run
just fmt .. - Run
nix build .#darwinConfigurations.fenrir.system. - Use
nix build .#darwinConfigurations.fenrir.system --dry-runfor a quick validation pass when you only need evaluation and dependency resolution. - Use
just darwin-debug <hostname>when diagnosing evaluation/runtime issues.
Document manual verification for user-facing changes (shell, terminal, window manager, app defaults, Homebrew behavior).
Commit & Pull Request Guidelines
Commit history follows Conventional Commit style: feat:, fix:, refactor:,
style:.
- Keep subject lines imperative and concise.
- Scope each commit to one logical change.
- In PRs, include: summary, affected modules/paths, command output used for validation, and any relevant screenshots for UI changes (for example WezTerm/AeroSpace behavior).
Security & Configuration Tips
- Never commit plaintext secrets.
- Store secrets only in
secrets/*.yamland manage keys/rules in.sops.yaml. .sops.yamlcurrently matchessecrets/.*\.yaml$; keep new secret files within that pattern or update the rule before committing.- If adding new secret-backed modules, continue reading from encrypted files via
the
secretsaspect rather than hardcoding credentials into aspect modules.