-
-
Notifications
You must be signed in to change notification settings - Fork 364
lib/modules: replace nixvim builders #3964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a07ae62
0639f67
ebaa5f6
abf1527
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,12 @@ let | |
| applyExtraConfig = "It has been moved to `lib.plugins.utils`"; | ||
| mkConfigAt = "It has been moved to `lib.plugins.utils`"; | ||
| }; | ||
|
|
||
| wrapEvalNixvim = | ||
| pred: fn: | ||
| lib.mirrorFunctionArgs self.modules.evalNixvim ( | ||
| input: fn (if pred input then input else self.modules.evalNixvim input) | ||
| ); | ||
| in | ||
| { | ||
| # Evaluate nixvim modules, checking warnings and assertions | ||
|
|
@@ -57,6 +63,48 @@ in | |
| } | ||
| // extraSpecialArgs; | ||
| }; | ||
|
|
||
| /** | ||
| Build a Nixvim package. | ||
|
|
||
| This is a thin wrapper around `<nixvim-configuration>.config.build.package`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line kinda confused me in the context of the rest of the docstring. We are building a package but it says its a thin wrapper around the output of a built package? Or am I reading it wrong?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is definitely challenging to phrase clearly. It is saying that it returns the In module system terminology, a "configuration" is the canonical name for the result of evaluating modules using Technically, I'm guessing there's simply not enough context that we're talking about the module system?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see. so
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe, but "option" alone doesn't do it justice, since it extracts the option value from a configuration (or any duck that looks like a configuration). Perhaps something like "this function returns the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that sounds good to me. |
||
|
|
||
| # Inputs | ||
|
|
||
| `input` | ||
| : One of: | ||
| 1. Arguments for `evalNixvim`. | ||
| 2. A Nixvim configuration, as produced by `evalNixvim`. | ||
| 3. A Nixvim package, as produced by `buildNixvim`. | ||
|
|
||
| # Output | ||
|
|
||
| An installable Nixvim package. | ||
| */ | ||
| buildNixvim = wrapEvalNixvim (input: input ? config.build.package) ( | ||
| configuration: configuration.config.build.package | ||
| ); | ||
|
|
||
| /** | ||
| Build a Nixvim test derivation. | ||
|
|
||
| This is a thin wrapper around `<nixvim-configuration>.config.build.test`. | ||
|
|
||
| # Inputs | ||
|
|
||
| `input` | ||
| : One of: | ||
| 1. Arguments for `evalNixvim`. | ||
| 2. A Nixvim configuration, as produced by `evalNixvim`. | ||
| 3. A Nixvim package, as produced by `buildNixvim`. | ||
|
|
||
| # Output | ||
|
|
||
| A buildable Nixvim test. | ||
| */ | ||
| testNixvim = wrapEvalNixvim (input: input ? config.build.test) ( | ||
| configuration: configuration.config.build.test | ||
| ); | ||
| } | ||
| // lib.mapAttrs ( | ||
| name: msg: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could do with a docstring as well explaining the purpose and what it does for us smooth brains.
Seems like this is the part that can handle a raw configuration or an already evaluated one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got lazy because this is private/internal and was extracted from functions that already had doc-comments. But you're right; this has enough logic and complexity to warrant some explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're fine, just figured I'd try to suggest something to aid anyone working with it who might not be as familiar with the nixpkgs lib functions involved to make it easier to understand what's happening here.