-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
module system: internalise prefix-stripping logic #203994
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
With the goal of making `toPretty` suitable for rendering option values, render derivations as `<derivation foo-1.0>` instead of `<derivation /nix/store/…-foo-1.0.drv>`. This is to avoid causing sudden evaluation errors for out-of-tree projects that have options with `default = pkgs.someUnfreePackage;` and no `defaultText`.
Render un`_type`d defaults and examples as `literalExpression`s using `lib.generators.toPretty` so that consumers don't have to reinvent Nix pretty-printing. `renderOptionValue` is kept internal for now intentionally. Make `toPretty` print floats as valid Nix values (without a tilde). Get rid of the now-obsolete `substSpecial` function. Move towards disallowing evaluation of packages in the manual by raising a warning on `pkgs.foo.{outPath,drvPath}`; later, this should throw an error. Instead, module authors should use `literalExpression` and `mkPackageOption`.
This variable is set to "master" on master and "release-YY.DD" on the release branches so that the manual can link to the correct revision.
A generic function to convert a path into a documentation-friendly {path, source, url} triple based on a list of file sources.
Provides a mechanism for rendering paths relative to a known prefix using angle bracket syntax. Backed by `lib.strings.lookupPrefix`.
Add an internal `_module.sources` option which specifies a list of sources to be used by `lib.strings.lookupPrefix` to render paths in option values and declarations. The sources always include the `nixpkgsSource`, which links to the manual for `lib.trivial.manualRevision`. Implement this logic in a new `lib.optionsToDocTemplate` function which deprecates `lib.optionAttrSetToDocList`. The returned option declarations are now attrsets as returned by `lookupPrefix`. If `decl.source` is set, then the declaration is rendered using angle bracket syntax: `<${decl.source}/${decl.path}>`. Other consumers are free to treat the source name as they intend. Deprecate `documentation.nixos.extraModuleSources`, converting it to `_module.sources` with `name` set to `_unknown`. We now call `eval-cacheable-options.nix` with a single filtered nixpkgs source, which is easier to maintain than a bunch of paths and allows things to work more smoothly (mainly `lib.trivial.release` can access ../.version, and `lib.nixpkgsSource` works as intended so we don't need to special-case anything).
github-actions
bot
added
6.topic: nixos
8.has: documentation
8.has: module (update)
labels
Dec 1, 2022
@ncfavier Why did you close this? |
I hardly remember what it was about and I have no interest any more, feel free to steal. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
6.topic: module system
About "NixOS" module system internals
6.topic: nixos
8.has: documentation
8.has: module (update)
10.rebuild-darwin: 0
10.rebuild-linux: 1-10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Split out from #199363, see discussions there.
Based on top of that PR to avoid conflicts, the first new commit is e9fe624.
Fixes #66917.
To do before merging:
To do after merging:
lib.trivial.manualRevision
to the release wiki