| Commit message (Expand) | Author | Age | Files | Lines |
| * | Merge pull request #249243 from lf-/jade/declarationsWithLocations•••nixos/modules: Add declarationPositions | Robert Hensing | 2023-09-17 | 1 | -4/+11 |
| |\ |
|
| | * | nixos/modules: Add declarationPositions•••What it does: line and column level *declaration* position information:
$ nix repl .
nix-repl> :p nixosConfigurations.micro.options.environment.systemPackages.declarationPositions
[ { column = 7; file = "/nix/store/24aj3k7fgqv3ly7qkbf98qvphasrw9nb-source/nixos/modules/config/system-path.nix"; line = 63; } ]
Use cases:
- ctags over NixOS options, as will be presented at NixCon 2023 ;)
- improving the documentation pages to go to the exact line of the
declarations.
Related work:
- https://github.com/NixOS/nixpkgs/pull/65024
This one does it for all *definitions* rather than declarations, and
it was not followed through with due to performance worries.
- https://github.com/NixOS/nixpkgs/pull/208173
The basis for this change. This change is just a rebase of that one.
I split it out to add the capability before adding users of it, in
order to simplify review. However, the ctags script in there is a
sample user of this feature.
Benchmarks: conducted by evaluating my own reasonably complex NixOS
configuration with the command:
`hyperfine -S none -w 1 -- "nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath"`
```
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.971 s ± 0.254 s [User: 5.872 s, System: 1.388 s]
Range (min … max): 8.574 s … 9.327 s 10 runs
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.766 s ± 0.160 s [User: 5.873 s, System: 1.346 s]
Range (min … max): 8.496 s … 9.033 s 10 runs
```
Summary of results: it seems to be in the noise, this does not cause any
visible regression in times.
| Jade Lovelace | 2023-09-08 | 1 | -4/+11 |
| * | | lib/modules: Report a better error when option tree has bare type•••Improves on 0d472a62012364d064f0b75f1da491242c6ae9c6
- https://github.com/NixOS/nixpkgs/pull/242339
We actually do have the file name.
Thanks Shawn8901 for the [feedback]!
feedback: https://github.com/NixOS/nixpkgs/pull/242339#issuecomment-1683107055
| Robert Hensing | 2023-08-18 | 1 | -3/+3 |
| * | | lib/modules: Report a good error when option tree has bare type•••Note that this removes the possibility of declaring an option
named `_type`.
| Robert Hensing | 2023-08-14 | 1 | -1/+33 |
| |/ |
|
| * | Merge pull request #245271 from sternenseemann/module-system-merge-no-type•••lib/modules: handle typeless options in mergeModules | Robert Hensing | 2023-07-27 | 1 | -1/+1 |
| |\ |
|
| | * | lib/modules: handle typeless options in mergeModules•••mkOption does not require a `type` argument and does not set the
resulting attribute if it is not given. Consequently, we need to be
prepared to merge options that have no type information.
| sternenseemann | 2023-07-26 | 1 | -1/+1 |
| * | | lib.mergeModules: Add context to error message | Robert Hensing | 2023-07-11 | 1 | -1/+4 |
| * | | lib/modules.nix: Format | Robert Hensing | 2023-07-11 | 1 | -19/+28 |
| * | | lib/modules.nix: Inline single-use `subtree` bindings | Robert Hensing | 2023-07-11 | 1 | -4/+4 |
| * | | lib/modules.nix: Make entire definition list strict in config check•••This is a non-trivial refactor that slightly changes the semantics
of the internal definition lists.
Whereas previously only individual list items would trigger the exception,
now the error is promoted to the whole list.
This is mostly ok, because we compute the value, it is wrong to ignore a definition.
However, we don't always compute the value. For instance `readOnly`
only needs to count definitions. That won't be possible anymore when
the error is raised for one of the items. As a consequence, an error
will be raised for the errant definition instead of the number of
definitions.
| Robert Hensing | 2023-07-11 | 1 | -24/+21 |
| * | | lib/modules.nix: Rename defnsByName -> pushedDownDefinitionsByName | Robert Hensing | 2023-07-11 | 1 | -2/+2 |
| * | | lib/modules.nix: Rename defnsByName' -> rawDefinitionsByName | Robert Hensing | 2023-07-11 | 1 | -3/+3 |
| * | | lib/modules.nix: Apply argument `module` of old f | Robert Hensing | 2023-07-11 | 1 | -9/+9 |
| * | | lib/modules.nix: Apply argument `modules` of old old old byName | Robert Hensing | 2023-07-11 | 1 | -6/+6 |
| * | | lib/modules.nix: Apply argument `f` of old old byName | Robert Hensing | 2023-07-11 | 1 | -15/+21 |
| * | | lib/modules.nix: Apply argument `attr` of old byName | Robert Hensing | 2023-07-11 | 1 | -31/+15 |
| * | | lib/modules.nix: Inline byName•••byName is not an abstraction. This is the first commit in a series
that refactors it away.
| Robert Hensing | 2023-07-11 | 1 | -27/+43 |
| |/ |
|
| * | Merge pull request #238136 from hercules-ci/nixos-nixpkgs-dont-check-when-_mo...•••`nixos/nixpkgs`: Don't check when `_module.args.pkgs` is set | Robert Hensing | 2023-06-23 | 1 | -0/+35 |
| |\ |
|
| | * | lib/modules.nix: Clean up mergeAttrDefinitionsWithPrio impl | Robert Hensing | 2023-06-23 | 1 | -9/+2 |
| | * | lib.modules: Add mergeAttrDefinitionsWithPrio•••This will let us make assertions involving _module.args.pkgs, which
is not an option but a value attribute, and therefore doesn't have
its own highestPrio to inspect. The new function gives us that info.
| Robert Hensing | 2023-06-16 | 1 | -0/+42 |
| * | | lib/modules: remove unused let bindings | figsoda | 2023-06-23 | 1 | -1/+0 |
| * | | lib: unhide _module.args•••this was a temporary fix that should hopefully no longer be necessary.
| pennae | 2023-06-16 | 1 | -5/+0 |
| * | | lib: turn *MD functions into aliases•••with docbook gone and MD the default these aren't needed any more. we
can't remove them yet because there's thousands of uses, but maybe some
day we can.
| pennae | 2023-06-13 | 1 | -12/+7 |
| |/ |
|
| * | lib.modules: configurationClass -> class•••This simplifies the documentation. `configuration` is implied by `_type`.
| Robert Hensing | 2023-05-06 | 1 | -1/+1 |
| * | lib.modules: in evalModules return move _module.class -> configurationClass | Robert Hensing | 2023-05-06 | 1 | -11/+1 |
| * | lib.modules: Change class declaration in module to _class | Robert Hensing | 2023-05-06 | 1 | -6/+6 |
| * | lib/modules: Move class out of specialArgs | Robert Hensing | 2023-05-06 | 1 | -7/+19 |
| * | lib/modules.nix: Deduplicate documentation•••`file://./..` looks redundant, but makes the url clickable in vscode.
| Robert Hensing | 2023-05-06 | 1 | -29/+2 |
| * | lib/modules: Only interpret class declaration in non-shorthand mode•••This is to avoid stealing keys from submodules. `class` might be
common enough that reinterpreting existing `class` attributes in
configurations as a declaration leads to fairly widespread problems.
| Robert Hensing | 2023-05-06 | 1 | -1/+1 |
| * | lib/modules.nix: Refactor: extract applyModuleArgs | Robert Hensing | 2023-05-06 | 1 | -5/+6 |
| * | lib/modules.nix: Refactor: evaluate applyModuleArgsIfFunction in attrs case | Robert Hensing | 2023-05-06 | 1 | -1/+1 |
| * | lib/modules.nix: Restore old collectModules interface | Robert Hensing | 2023-05-06 | 1 | -1/+1 |
| * | lib/modules: Explain that a configuration can't be loaded as a module | Robert Hensing | 2023-05-06 | 1 | -1/+6 |
| * | lib/modules: Improve error when a configuration is imported•••This is appears to be a fairly common mistake for beginners who want
to build larger things from the system configurations, such as NixOps
networks, etc. Further explanation seems appropriate.
| Robert Hensing | 2023-05-06 | 1 | -0/+1 |
| * | lib/modules: Check against importing things with a _type | Robert Hensing | 2023-05-06 | 1 | -1/+8 |
| * | lib/modules: Add class concept to check imports•••This improves the error message when an incompatible module is
imported.
| Robert Hensing | 2023-05-06 | 1 | -4/+22 |
| * | lib/modules.nix: Make some functions private•••The supposedly public nature of these functions has been holding
back module system maintenance, while usages of these functions
are expected to be rare. If used anywhere, presumably they're
emulating module system behavior because some use case isn't supported
properly. We should try to support such a use case directly, if it
even exists.
| Robert Hensing | 2023-05-06 | 1 | -11/+22 |
| * | lib/modules.nix: Use explicit exports | Robert Hensing | 2023-05-06 | 1 | -4/+52 |
| * | lib/modules: better error for invalid option declarations•••Make `byName` aware of whether it's processing options or config to give
slightly more accurate error messages.
| Naïm Favier | 2023-03-22 | 1 | -4/+8 |
| * | 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 Hensing | 2023-03-01 | 1 | -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 Favier | 2023-01-08 | 1 | -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.
| pennae | 2023-01-05 | 1 | -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.
| pennae | 2023-01-05 | 1 | -2/+11 |
| * | lib: fix typos | figsoda | 2022-12-17 | 1 | -1/+1 |
| * | Merge pull request #204103 from ncfavier/doc-mkOrder•••nixos/doc: document `mkOrder` and friends | Valentin Gagarin | 2022-12-02 | 1 | -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 Favier | 2022-12-02 | 1 | -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 Hensing | 2022-12-02 | 1 | -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 Levy | 2022-11-03 | 1 | -2/+2 |
| * | Merge pull request #193132 from figsoda/clean-up•••treewide: clean up | figsoda | 2022-10-01 | 1 | -9/+1 |
| |\ |
|
| | * | lib/modules.nix: remove unused bindings | figsoda | 2022-09-26 | 1 | -9/+1 |