Skip to content

Conversation

@vic
Copy link
Owner

@vic vic commented Nov 17, 2025

This introduces parametric.withOwn that is just a parametric.atLeast that also includes the aspect owned configs.

See discussion: #91 (reply in thread)

Calling parametric x itself is an alias for parametric.withOwn x.

So that both syntax do the same:

den.aspects.foo = {
  __functor = den.lib.parametric;
  nixos.foo = 1;
  includes = [ bar ];
};

and also, *this is the preferred syntax that will be documented, since it is more intuitive and does not surfaces __functor:


den.aspects.foo = den.lib.parametric {
  nixos.foo = 1;
  includes = [ bar ];
};

Still have to update documentation about this combinator.

Fixes #97.

@vic vic changed the title Provide a parametric combinator that is atLeast but preserves owned c… Provide a parametric combinator that is atLeast but preserves owned configs Nov 17, 2025
@vic vic marked this pull request as ready for review November 17, 2025 07:10
Copilot AI review requested due to automatic review settings November 17, 2025 07:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new parametric.withOwn combinator that combines parametric aspect behavior with owned configurations, providing a more intuitive API for defining aspects. The preferred syntax den.lib.parametric { ... } now creates aspects that include both their static configs and parametric includes.

Key changes:

  • Added parametric.withOwn function that combines owned and parametric.atLeast behaviors
  • Updated parametric.__functor to dispatch to withOwn when called with attribute sets (previously dispatched to fixedTo)
  • Renamed parameter from ctx to arg in __functor for clarity

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
nix/lib.nix Adds parametric.withOwn combinator and updates __functor to make parametric { ... } an alias for withOwn, with parameter renaming for clarity
modules/aspects/dependencies.nix Refactors to extract context into a named binding and explicitly uses parametric.fixedTo to preserve existing behavior after __functor changes
templates/examples/modules/_example/ci/parametric-with-owned.nix Adds comprehensive test demonstrating the new parametric.withOwn functionality with context forwarding and owned config inclusion

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vic vic merged commit 959ce3e into main Nov 17, 2025
3 of 8 checks passed
@vic vic deleted the owned branch November 17, 2025 10:32
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.

Provide a parametric combinator that is atLeast but preserves owned configs.

2 participants