Skip to content

Use { userToHost } and { hostToUser } contexts.#54

Merged
vic merged 1 commit intomainfrom
userToHost
Nov 8, 2025
Merged

Use { userToHost } and { hostToUser } contexts.#54
vic merged 1 commit intomainfrom
userToHost

Conversation

@vic
Copy link
Owner

@vic vic commented Nov 8, 2025

Instead of previous: { fromUser, toHost } and { fromHost, toUser }.

The reason is detailed at #47.

Closes #47.

Instead of previous: `{ fromUser, toHost }` and `{ fromHost, toUser }`.

The reason is detailed at #47.

Closes #47.
Copilot AI review requested due to automatic review settings November 8, 2025 09:00
@vic vic marked this pull request as ready for review November 8, 2025 09:00
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 refactors the context structure in the aspect system to improve API clarity. Instead of using flat fromUser/toHost and fromHost/toUser parameters, the new API uses nested structures userToHost (with .user and .host fields) and hostToUser (with .host and .user fields), making the direction of contribution more explicit.

Key Changes:

  • Replaced { fromUser, toHost } parameter pattern with { userToHost, ... } where userToHost contains .user and .host fields
  • Replaced { fromHost, toUser } parameter pattern with { hostToUser, ... } where hostToUser contains .host and .user fields
  • Updated all aspect definitions and examples to use the new nested context structure
  • Added test coverage for the new userToHost context pattern
  • Improved code maintainability by using inherit destructuring consistently

Reviewed Changes

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

Show a summary per file
File Description
templates/default/modules/_profile/users/fido/common-host-env.nix Updated user-to-host contribution to use nested userToHost.user and userToHost.host structure
templates/default/modules/_profile/profiles/single-user-is-admin.nix Refactored to use userToHost context with destructuring, added __functor for proper context propagation, simplified includes logic
templates/default/modules/_profile/hosts/bones/common-user-env.nix Updated host-to-user contribution to use nested hostToUser.host and hostToUser.user structure
templates/default/modules/_example/aspects.nix Updated example aspects to demonstrate the new userToHost and hostToUser API patterns
modules/aspects/provides/user-shell.nix Refactored userToHostContext to destructure userToHost and access nested user field
modules/aspects/provides/primary-user.nix Updated to destructure userToHost into host and user for cleaner code
modules/aspects/provides/define-user.nix Refactored to use destructured userToHost context with explicit inherit declaration
modules/aspects/dependencies.nix Core implementation of the new nested context structures in hostIncludesFromUsers and userIncludesFromHost functions
checkmate/tests/aspect-functor.nix Added test case for the new userToHost context pattern to ensure proper functor behavior

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

@vic vic changed the title breaking: Use { userToHost } and { hostToUser } contexts. Use { userToHost } and { hostToUser } contexts. Nov 8, 2025
@vic vic merged commit 4f5653b into main Nov 8, 2025
13 checks passed
@vic vic deleted the userToHost branch November 8, 2025 09:08
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.

Some nix linters will remove unused arguments, causing context problems

1 participant