Skip to content

Add schemas for flakeModules and aspects outputs#45

Open
lessuselesss wants to merge 3 commits intoDeterminateSystems:mainfrom
lessuselesss:add-flakemodules-aspects-schemas
Open

Add schemas for flakeModules and aspects outputs#45
lessuselesss wants to merge 3 commits intoDeterminateSystems:mainfrom
lessuselesss:add-flakemodules-aspects-schemas

Conversation

@lessuselesss
Copy link

@lessuselesss lessuselesss commented Oct 22, 2025

Summary

This PR adds schema definitions for two new flake output types commonly used in the flake-parts and dendrix ecosystems:

flakeModules Schema

  • Defines validation for flakeModules output
  • For flake-parts modules that can be imported by other flakes
  • Validates each module is a function or attribute set
  • Documentation includes reference to flake.parts

aspects Schema

  • Defines validation for aspects output
  • For aspect-oriented modules organized by cross-cutting concerns
  • Two-level nesting: <aspect>.<class>.<module>
  • Example: vim-btw.nixos, tiling-desktop.darwin, awesome-cli.homeManager
  • Used with flake-aspects library
  • Supports dendrix ecosystem

Implementation Details

Both schemas:

  • Follow established patterns in the codebase (similar to nixosModules, homeModules, darwinModules)
  • Use checkModule validation to ensure modules are functions or attribute sets
  • Include comprehensive documentation
  • Version 1 schema format

Testing

  • ✅ Code formatted with nixfmt-rfc-style
  • nix flake check passes successfully
  • ✅ Evaluated against real-world usage in vic/vix repository
  • ✅ Both schemas accessible and functional

References

Summary by CodeRabbit

  • New Features

    • Added two new public schemas to organize and validate flake modules inventories and to define aspects with class-to-module mappings.
    • Both schemas are exposed through the flake schemas interface for discovery and validation.
  • Documentation

    • README updated to list the new flake output types (aspects, flakeModules) and add related reference links.

This commit adds schema definitions for two new flake output types:

- flakeModules: Schema for flake-parts modules that can be imported by
  other flakes to extend functionality and share configuration patterns.
  Validates that each module is a function or attribute set.

- aspects: Schema for aspect-oriented modules organized by cross-cutting
  concerns. Supports the flake-aspects pattern where modules are nested
  as <aspect>.<class>.<module> (e.g., vim-btw.nixos, tiling-desktop.darwin).

Both schemas follow the established patterns in the codebase and were
tested against real-world usage in vic/vix and dendrix repositories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Oct 22, 2025

Walkthrough

Added two flake output schemas, flakeModulesSchema and aspectsSchema, that build inventories from flake outputs using checkModule/isFunctionOrAttrs, and exposed them on the public schemas map as schemas.flakeModules and schemas.aspects.

Changes

Cohort / File(s) Summary
Schema definitions & exports
flake.nix
Added flakeModulesSchema (inventory of "flake-parts module" entries validated with isFunctionOrAttrs via checkModule) and aspectsSchema (inventory of "aspect" entries mapping classes to modules, validated similarly). Updated schemas map to expose schemas.flakeModules and schemas.aspects.
Documentation update
README.md
Documented two new flake output types: aspects and flakeModules, and added corresponding "Read more" links for aspects and flake-parts.

Sequence Diagram(s)

sequenceDiagram
  participant Flake as Flake outputs
  participant SchemaGen as outputs let (schema builder)
  participant Public as Public `schemas` map

  Note over Flake,SchemaGen: New outputs present in flake
  Flake->>SchemaGen: provide output attributes (modules, aspects)
  SchemaGen->>SchemaGen: build `flakeModulesSchema` (inventory + checkModule/isFunctionOrAttrs)
  SchemaGen->>SchemaGen: build `aspectsSchema` (inventory mapping classes → modules + checkModule/isFunctionOrAttrs)
  SchemaGen->>Public: set `schemas.flakeModules` -> flakeModulesSchema
  SchemaGen->>Public: set `schemas.aspects` -> aspectsSchema
  Note right of Public: Schemas exposed to consumers
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit nibbles by the code,
Two little schemas find their road,
Modules, aspects neatly spun,
Checked and mapped, their hops begun,
🐇✨ fresh configs, quietly stowed.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Add schemas for flakeModules and aspects outputs" is directly and specifically related to the main changes in the changeset. The PR's primary objective is to introduce two new schema definitions—flakeModulesSchema and aspectsSchema—for validating the flakeModules and aspects flake outputs in the flake-parts and dendrix ecosystems. The title accurately reflects this core change, is concise at 48 characters, uses clear and specific terminology without vague language or noise, and would allow a teammate reviewing the commit history to immediately understand the primary contribution of this PR.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2252260 and 2e65542.

📒 Files selected for processing (1)
  • README.md (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Add the two new schema types to the list of supported flake output types:
- flakeModules: Links to flake.parts documentation
- aspects: Links to flake-aspects GitHub repository

Both entries are alphabetically sorted in the list.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8fcf96a and 2252260.

📒 Files selected for processing (1)
  • README.md (2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
README.md

74-74: Link and image reference definitions should be needed
Unused link or image reference definition: "branch"

(MD053, link-image-reference-definitions)

🔇 Additional comments (1)
README.md (1)

20-20: Documentation updates align well with new schemas.

The addition of aspects and flakeModules to the supported flake output types list is properly formatted and alphabetically positioned. The corresponding link references point to appropriate external resources (flake-aspects and flake.parts), maintaining consistency with the documentation structure.

Also applies to: 26-26, 72-72, 80-80

Remove unused [branch] link reference definition flagged by markdownlint.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant