Skip to content

feat: add inputs' and self' aspects#117

Merged
vic merged 1 commit intodenful:mainfrom
HeitorAugustoLN:inputs-self
Dec 12, 2025
Merged

feat: add inputs' and self' aspects#117
vic merged 1 commit intodenful:mainfrom
HeitorAugustoLN:inputs-self

Conversation

@HeitorAugustoLN
Copy link
Copy Markdown
Collaborator

@HeitorAugustoLN HeitorAugustoLN commented Dec 11, 2025

Adds inputs' and self' aspects

Copilot AI review requested due to automatic review settings December 11, 2025 20:29
Copy link
Copy Markdown

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 adds support for inputs' and self' context variables throughout the module system without relying on specialArgs. The implementation uses the withSystem function to inject system-specific inputs and self references into module contexts.

  • Introduces withSystem parameter to enable per-system context injection
  • Wraps mainModule creation with withSystem to provide inputs' and self' from flake-parts
  • Threads the new context variables through all dependency and integration functions

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
modules/options.nix Adds withSystem parameter and passes it to _types.nix
modules/_types.nix Wraps mainModule function with withSystem to inject inputs' and self' into aspect context
modules/aspects/provides/home-manager.nix Updates homeManager function to accept and forward inputs' and self' parameters
modules/aspects/dependencies.nix Updates all dependency functions (osDependencies, osUserDependencies, hmUserDependencies, hmStandaloneDependencies) to accept and propagate inputs' and self'

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

Comment thread modules/aspects/dependencies.nix Outdated
Comment thread modules/aspects/provides/home-manager.nix Outdated
@vic
Copy link
Copy Markdown
Member

vic commented Dec 11, 2025

Hey, thanks for the PR!

  • I'm currently trying to decouple as much as possible from flake-parts and trying to reduce dependencies on it and its idioms. In the future I'd like den to be able to work without flakes and without flake-parts, so people using den will be able to choose if using flake-parts, or just evalModules like dendritic-unflake does or falake.

  • What is the specific use for self' or inputs' in this PR ? I mean, if people can use the module-system to have access both of them why should Den include them as this PR does?

I'm still working on decoupling flake-file from flakes (using unflake) but will keep this open and take a more deeper look later.

@vic
Copy link
Copy Markdown
Member

vic commented Dec 11, 2025

Den has a test suite now, and each feature is tested. Could you provide a test that shows it is NOT possible to use inputs'/self' unless we merge this PR ?

@HeitorAugustoLN
Copy link
Copy Markdown
Collaborator Author

It is really not possible currently, but yeah, it won't be supported for configurations that aren't using flake-parts, so I will just use inputs.input.packages.${host.system}.package

@HeitorAugustoLN HeitorAugustoLN deleted the inputs-self branch December 11, 2025 22:28
@vic
Copy link
Copy Markdown
Member

vic commented Dec 11, 2025

Can you show me an example of where you are trying to use it and are unable to ? How about using withSystem instead ?

We currently depend on withSystem, see https://github.com/vic/den/blob/3ec43279b5afea898737238a75178079bf91d606/modules/config.nix#L31

@HeitorAugustoLN
Copy link
Copy Markdown
Collaborator Author

Can you show me an example of where you are trying to use it and are unable to?

I can use it in perSystem or by using withSystem, so if I want to use it in an aspect I would have to use withSystem, but then it would be too verbose.

I currently have one use case that is basically importing my wrapped neovim from another flake with home.packages = [ inputs'.neovim.packages.default ];. since I haven't migrated yet to a dendritic approach, I use specialArgs in https://github.com/HeitorAugustoLN/nix-config/blob/1741a49777865cd1472ba3ad3d207b3dfe9c1abe/flake/configurations.nix#L139-L166

@HeitorAugustoLN HeitorAugustoLN restored the inputs-self branch December 11, 2025 23:48
@vic
Copy link
Copy Markdown
Member

vic commented Dec 12, 2025

I haven't tried it but if withSystem gives you access to inputs' could we have a simple aspect that just exposes it ?

I'd prefer if we made something like this possible:

{ withSystem, ... }: {
  den.aspects.provide-system-self = {
    _module.args.self' = (withSystem { self', ... }: self');
  };
}

But we extending a module that is included in all aspects, so all have access to this self' , what do you think ?

In other words: being able to contribute to a module that is part of all aspects ? Is it den.default ?

@HeitorAugustoLN HeitorAugustoLN changed the title feat: add inputs' and self' context feat: add inputs' and self' aspects Dec 12, 2025
Copy link
Copy Markdown

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

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


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

Comment thread templates/examples/modules/_example/ci/special-args.nix
Comment thread modules/aspects/provides/self.nix
Comment thread modules/aspects/provides/inputs.nix Outdated
Comment thread modules/aspects/provides/self.nix
Comment thread modules/aspects/provides/inputs.nix Outdated
{ den, withSystem, ... }:
let
description = ''
Provides the `flake-parts` `inputs'` (the flake's inputs with system pre-selected)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 You are awesome, I like this a lot, den.provides.inputs is an opt-in feature for people who uses flake-parts.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure about the name, but I like it.

@HeitorAugustoLN
Copy link
Copy Markdown
Collaborator Author

I am having some difficulty with the aspects lol, but I might have figured it out

Comment thread modules/aspects/provides/self.nix Outdated
@HeitorAugustoLN
Copy link
Copy Markdown
Collaborator Author

Fixed the aspect issue, any thoughts on why it fails on darwin?

@HeitorAugustoLN
Copy link
Copy Markdown
Collaborator Author

HeitorAugustoLN commented Dec 12, 2025

Ok, I understood what went wrong, the host and home we are checking is x86_64-linux only, when we run it through perSystem it uses its respective system such as aarch64-darwin, but the host and home still uses the same system as before

@vic
Copy link
Copy Markdown
Member

vic commented Dec 12, 2025

Awesome! I'm merging this!

Can I ask for another favor ? Please update the wiki documentation just so we have a way for people to discover den._.inputs' and den._.self'.

Thanks!

@vic vic merged commit 4d439f4 into denful:main Dec 12, 2025
8 checks passed
@HeitorAugustoLN HeitorAugustoLN deleted the inputs-self branch December 12, 2025 20:58
@HeitorAugustoLN
Copy link
Copy Markdown
Collaborator Author

Where is it?

@vic
Copy link
Copy Markdown
Member

vic commented Dec 12, 2025

Here: https://github.com/vic/den/wiki (it was private haha)

@vic
Copy link
Copy Markdown
Member

vic commented Dec 12, 2025

Get published on any file change at https://den.oeiuwq.com/

@HeitorAugustoLN
Copy link
Copy Markdown
Collaborator Author

Ok!

@HeitorAugustoLN
Copy link
Copy Markdown
Collaborator Author

HeitorAugustoLN commented Dec 12, 2025

I improved the descriptions of these aspects in #118, also I am not able to edit the wiki apparently

@vic
Copy link
Copy Markdown
Member

vic commented Dec 12, 2025

Oh, Ok. I'll update then wiki tomorrow then. Thanks so much I'll also merge #118

vic pushed a commit that referenced this pull request Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants