summaryrefslogtreecommitdiff
path: root/lib/modules.nix (follow)
Commit message (Expand)AuthorAgeFilesLines
* lib/modules: Allow an "anonymous" module with key in disabledModules•••This makes the following work disabledModules = [ foo.nixosModules.bar ]; even if `bar` is not a path, but rather a module such as { key = "/path/to/foo#nixosModules.bar"; config = ...; } By supporting this, the user will often be able to use the same syntax for both importing and disabling a module. This is becoming more relevant because flakes promote the use of attributes to reference modules. Not all of these modules in flake attributes will be identifiable, but with the help of a framework such as flake-parts, these attributes can be guaranteed to be identifiable (by outPath + attribute path). Robert Hensing2023-03-011-5/+29
* lib/modules: make `mkAliasOptionModule` emit DocBook•••Follow-up to https://github.com/NixOS/nixpkgs/pull/208407 Removing `mdDoc` isn't enough, we need to emit actual DocBook. Naïm Favier2023-01-081-3/+5
* lib/modules: hide _module.args docs•••unfortunately we can't unconditionally make this text markdown without impacting downstream users of docs generation (as noted in #175586). hide it entirely until the transition is complete. pennae2023-01-051-0/+5
* modules: add mkAliasOptionModuleMD•••mkAliasOptionModule should not default to mdDoc descriptions because that can break out-of-tree users of documentation infrastructure. add an explicitly-MD variant for now, to be removed some time after the MD transition is complete. pennae2023-01-051-2/+11
* lib: fix typosfigsoda2022-12-171-1/+1
* Merge pull request #204103 from ncfavier/doc-mkOrder•••nixos/doc: document `mkOrder` and friendsValentin Gagarin2022-12-021-9/+10
|\
| * nixos/doc: document `mkOrder` and friends•••Add a section on ordering option definitions. Also mention `mkDefault` in the section on `mkOverride`. Clarify the code a bit by renaming `defaultPriority` to `defaultOverridePriority` and introducing `defaultOrderPriority`. Naïm Favier2022-12-021-9/+10
* | lib/modules: Add context to the "option does not exist" error•••Add trace items that provide context for a failed definition that can not be caught within the Nix language. This also adds a test for the `tryEval` behavior of `showDefs`. Robert Hensing2022-12-021-1/+12
|/
* lib.modules.doRename: Don't define warning, even as undefined, if not warning.•••This fixes mkAliasOptionModule in systems with no warning option. Shea Levy2022-11-031-2/+2
* Merge pull request #193132 from figsoda/clean-up•••treewide: clean upfigsoda2022-10-011-9/+1
|\
| * lib/modules.nix: remove unused bindingsfigsoda2022-09-261-9/+1
* | Merge pull request #191540 from hercules-ci/nixosTest-modular•••nixosTest: make modularRobert Hensing2022-09-281-1/+2
|\ \ | |/ |/|
| * lib/modules: Fix meta duplication in shorthand syntaxRobert Hensing2022-09-211-1/+2
* | lib/modules: add `definitionsWithLocations` to evaluated options•••This attr provides the location of each definition. This is particularly useful for introspecting options of type `attrsOf`. E.g., it allows finding the location of a systemd service definition by parsing `options.systemd.services.definitionsWithLocations`. Erik Arvstedt2022-09-051-0/+1
|/
* Merge branch 'master' into option-docs-mdpennae2022-09-011-1/+3
|\
| * lib.modules: support strings with absolute paths in `disabledModules`•••This is particularly useful for disabling modules defined in a flake. Example: disabledModules = [ "${flake}/modules/mymodule.nix" ]; Previously, absolute string paths were internally prepended with `modulesPath`, which caused the module filtering to fail. Erik Arvstedt2022-08-311-1/+3
* | lib/modules: convert option description to MDpennae2022-08-311-77/+43
|/
* lib/modules: Add _module.specialArgsRobert Hensing2022-07-211-0/+10
* lib/modules: Throw earlier when module function does not return attrs•••`m` must always be an attrset at this point. It is basically always evaluated. This will make it throw when any of the attrs is accessed, rather than just `config`. We assume that this will improve the error message in more scenarios. Robert Hensing2022-06-141-3/+2
* lib.types: Add deferredModuleWithRobert Hensing2022-06-141-1/+3
* lib/types, lib/modules: Remove unused extensionOffsetRobert Hensing2022-06-141-7/+1
* lib/modules: Fix missing prefix in extendModules when unset in both eval- and...Robert Hensing2022-06-101-1/+1
* Merge pull request #167776 from hercules-ci/lib-modules-allow-disable-_module...•••lib.modules: Allow making _module.args internalRobert Hensing2022-04-301-1/+4
|\
| * lib.modules: Allow making _module.args internal•••This allows other module system consumers to disable these docs via option merging. For instance arion uses asciidoc instead of docbook so that would look awful. Robert Hensing2022-04-111-1/+4
* | lib.types.submoduleWith: Avoid _key collisions after extendModulesRobert Hensing2022-04-241-1/+7
|/
* Merge pull request #165540 from Infinisil/module-args-docs•••lib/modules: Document `_module.args`Robert Hensing2022-04-051-3/+87
|\
| * lib/modules: Document _module.args•••Documents the _module.args option, motivated by many usages in Flakes, especially with the deprecation of extraArgs (https://github.com/NixOS/nixpkgs/commit/78ada833615d241ed76463aa5a024b614150eb4d) The documentation rendering for this option had to be handled a bit specially, since it's not declared in nixos/modules like all the other NixOS options. Co-Authored-By: pennae <github@quasiparticle.net> Co-Authored-By: Robert Hensing <robert@roberthensing.nl> Silvan Mosberger2022-04-051-3/+87
* | Merge pull request #164651 from Infinisil/remove-optionSet•••lib/modules: Finally remove deprecated types.optionSetSilvan Mosberger2022-03-251-28/+6
|\ \
| * | lib/modules: Finally remove deprecated types.optionSet•••types.optionSet has been deprecated for almost 10 years now (0e333688cea468a28516bf6935648c03ed62a7bb)! A removal was already attempted in 2019 (27982b408e465554b8831f492362bc87ed0ec02a), but it was promptly reinstantiated since some third-party uses were discovered (f531ce75e4178c6867cc1d0f7fec96b2d5c3f1cb). It's finally time to remove it for good :) Silvan Mosberger2022-03-181-28/+6
* | | Merge remote-tracking branch 'upstream/master' into tests-restrict-argumentsRobert Hensing2022-03-211-12/+82
|\ \ \ | | |/ | |/|
| * | Merge pull request #163451 from hercules-ci/stop-premature-warnings•••Stop premature warnings, including `nix.settings` migrationKevin Cox2022-03-211-0/+20
| |\ \ | | |/ | |/|
| | * lib.mkRenamedOptionModuleWith: Remove warnWhenRead•••Let's keep things simple and not poke holes in the improved migration process. Robert Hensing2022-03-211-9/+1
| | * lib: Add mkRenamedOptionModuleWith•••Adds support for sinceRelease Robert Hensing2022-03-091-0/+28
| * | Merge pull request #156533 from hercules-ci/issue-146882-transparent-submodul...•••lib.modules: Let module declare options directly in bare submoduleSilvan Mosberger2022-03-161-12/+62
| |\ \
| | * | lib/modules.nix: Add comment about internal shorthand null valueRobert Hensing2022-03-071-0/+3
| | * | lib/modules.nix: Move comment to the actual legacy codeRobert Hensing2022-03-071-3/+4
| | * | Revert "lib.modules: Remove redundant fixupOptionType in option injection"•••This reverts commit 6b077c47ff14cb9a4a8f5cb8986fa83ff626c732. Thanks Infinisil for discovering this problem: > After a lot of trial and error, trying to prove why fixupOptionType should > be used here or not, I figured it out: It's needed for the sake of file > locations in error messages. Robert Hensing2022-03-071-1/+1
| | * | lib.modules: Remove redundant fixupOptionType in option injectionRobert Hensing2022-03-031-1/+1
| | * | lib.modules: Make option injection work when shorthandOnlyDefinesConfigRobert Hensing2022-03-031-0/+1
| | * | lib.modules: Improve option-is-prefix error messageRobert Hensing2022-03-031-3/+21
| | * | lib.modules: Explain why options can only be merged into submodulesRobert Hensing2022-03-031-0/+9
| | * | lib.modules: Refactor option scanning slightly•••This scans the options with fewer function calls, improving performance. It also removes a let Env from the happy flow of the new logic. Robert Hensing2022-03-031-10/+8
| | * | lib.types.submodule: Remove redundant isSubmodule attrRobert Hensing2022-03-031-1/+1
| | * | lib.modules: Let module declare options directly in bare submodule•••... where a bare submodule is an option that has a type like `submoduleWith x`, as opposed to `attrsOf (submoduleWith x)`. This makes migration unnecessary when introducing a freeform type in an existing option tree. Closes #146882 Robert Hensing2022-03-031-1/+21
| | |/
* | / lib: applyIfFunction -> applyModuleArgsIfFunctionRobert Hensing2022-03-211-3/+3
|/ /
* / lib/modules.nix: Optimize optionSet legacy compat code•••It's still in the hot path. Robert Hensing2022-03-071-5/+5
|/
* lib.modules: Use types.optionType for _module.freeformType•••This ensures that the module file locations are propagated to the freeform type, which makes it so that submodules in freeform types now have their declaration location shown in the manual, fixing https://github.com/NixOS/nixpkgs/issues/132085. In addition, this also newly allows freeformTypes to be declared multiple times and all declarations being merged together according to normal option merging. This also removes some awkwardness regarding the type of `freeformType` Silvan Mosberger2022-03-011-2/+1
* lib/modules: Use types.raw for _module.args•••Fixes https://github.com/NixOS/nixpkgs/issues/53458, as types.raw doesn't allow setting multiple values Silvan Mosberger2022-02-221-1/+1
* lib/modules: introduce setDefaultModuleLocation•••Wraps a module with a default location for reporting errors. Naïm Favier2022-01-271-5/+7
* lib/modules: extract multiply-used value in byName•••module.${attr} is used at least twice, so it must be evaluated at least twice (and since it's a function argument, be turned into a thunk twice). pennae2021-12-281-4/+4