summaryrefslogtreecommitdiff
path: root/lib/tests/modules (follow)
Commit message (Expand)AuthorAgeFilesLines
* lib/modules: Use fixed lib instead of args.lib•••The practical use for this should be very limited because I don't think anyone should change `lib`, let alone change `lib.functionArgs`, but, but it would be even stranger to rely on `args.lib` (or really `specialArgs.lib` for what's clearly a behavior of the current `evalModules`, which uses its own ambient lib for basically everything. The shadowing of `lib` by `args.lib` here seems to be a small mistake, which is easy to make. Robert Hensing2024-07-031-0/+28
* Merge pull request #284551 from hercules-ci/types-attrTag•••Add `types.attrTag`Silvan Mosberger2024-04-093-0/+190
|\
| * lib.types.attrTag: Fix declarationPositions after mergeRobert Hensing2024-04-041-3/+17
| * lib/tests/modules/types-attrTag.nix: Test other option doc attrsRobert Hensing2024-04-041-0/+9
| * lib/tests/modules/types-attrTag.nix: Clean up unneeded commentRobert Hensing2024-04-041-1/+0
| * lib.types.attrTag: Custom error when passing bare typeRobert Hensing2024-04-041-0/+14
| * lib/tests/modules/types-attrTag: Test against unexpected attrs•••Thank you lheckemann for pointing this out! Robert Hensing2024-04-041-6/+6
| * lib.types.attrTag: Provide declarations, definitionsRobert Hensing2024-04-041-0/+1
| * lib.types.attrTag: Support type mergingRobert Hensing2024-04-041-0/+10
| * lib.types.attrTag: Take options instead of typesRobert Hensing2024-04-041-15/+34
| * lib.types.attrTag: Support module docsRobert Hensing2024-04-042-0/+60
| * lib.types.attrTag: initRobert Hensing2024-02-111-0/+64
* | doc: migrate trivial files to doc-comment format (#299986)•••* doc: migrate trivial files to doc-comment format * fix: revert some comments * Apply suggestions from code review Thanks @danielSidhion Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com> * Update lib/types.nix --------- Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com> Co-authored-by: Silvan Mosberger <github@infinisil.com>Johannes Kirschbauer2024-04-041-2/+2
* | Avoid top-level `with ...;` in lib/tests/modules/extendModules-168767-imports...Philip Taron2024-03-111-1/+8
* | Avoid top-level `with ...;` in lib/tests/modules/alias-with-priority.nixPhilip Taron2024-03-111-3/+10
* | Avoid top-level `with ...;` in lib/tests/modules/alias-with-priority-can-over...Philip Taron2024-03-111-3/+10
|/
* Merge pull request #284512 from hercules-ci/lib-types-unique-merge•••lib.types.unique: Check inner type deeplySilvan Mosberger2024-02-101-0/+27
|\
| * lib.types.unique: Check inner type deeply•••This doesn't change uniq. Why not? - In NixOS it seems that uniq is only used with simple types that are fully checked by t.check. - It exists for much longer and is used more widely. - I believe we should deprecate it, because unique was already better. - unique can be a proving ground. Robert Hensing2024-01-281-0/+27
* | lib.modules.doRename: Add condition parameter•••This is to support single-to-multi service migrations, so that the `to` (e.g. `foos.""`) isn't defined unconditionally. See test cases. Robert Hensing2024-02-024-0/+71
* | feat: add test for nonEmptyListOf submoduleDanila Danko2024-01-301-0/+7
|/
* lib: `modules.sh` should check JSON output for predictability•••Currently, the `lib/tests/modules.sh` test checks the output of `nix-instantiate --eval` without `--json`, which outputs an unspecified human-readable format. This patch modifies `modules.sh` to use the `--json` output instead, to be robust against future changes to `nix-instantiate` output. Rebecca Turner2023-12-193-3/+10
* Merge pull request #272709 from hercules-ci/module-system-test-pr-131205•••lib/modules: Test optionless module errors from #131205Maximilian Bosch2023-12-102-0/+26
|\
| * lib/modules: Test optionless module errors from #131205Robert Hensing2023-12-092-0/+26
* | lib.types.boolByOr: init•••This type is necessary to have correct merging behavior for `allowUnfreePredicate` and `allowInsecurePredicate` Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Silvan Mosberger2023-12-081-0/+14
|/
* lib/tests: add test for pkgsText parameter and package set selection of mkPac...Anselm Schüler2023-10-101-0/+8
* lib/tests: add more tests for mkPackageOptionAnselm Schüler2023-10-061-0/+26
* lib.gvariant: make the tests really worklinsui2023-09-281-86/+54
* Merge pull request #249243 from lf-/jade/declarationsWithLocations•••nixos/modules: Add declarationPositionsRobert Hensing2023-09-171-0/+49
|\
| * 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 Lovelace2023-09-081-0/+49
* | lib/gvariant: initlinsui2023-08-151-0/+93
* | 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 Hensing2023-08-143-0/+16
|/
* Merge pull request #243139 from hercules-ci/modules-test-default-argument•••lib/tests/modules: Test that _module.args works when a default argume…Robert Hensing2023-08-021-0/+9
|\
| * lib/tests/modules: Test that _module.args works when a default argument is setRobert Hensing2023-07-121-0/+9
* | Merge pull request #245271 from sternenseemann/module-system-merge-no-type•••lib/modules: handle typeless options in mergeModulesRobert Hensing2023-07-271-0/+25
|\ \ | |/ |/|
| * 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. sternenseemann2023-07-261-0/+25
* | lib/tests: invalidate hashes•••Having the current bash hash present in the nixpkgs tree makes Nix detect bash as a runtime dependency of nixpkgs, which in turns messes up `fetchFromGitHub` due to https://github.com/NixOS/nix/issues/6660 Naïm Favier2023-07-051-3/+3
|/
* lib/tests/modules.sh: Test types.pathInStore•••Add missing test cases. I think the .links case should be rejected even though it's technically a path in the store. Robert Hensing2023-06-271-0/+24
* 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 Hensing2023-06-161-0/+21
* lib/tests: add mkPackageOption testsNaïm Favier2023-05-201-0/+19
* lib.modules: Change class declaration in module to _classRobert Hensing2023-05-063-4/+4
* lib/tests/modules.sh: Add submodule + class testsRobert Hensing2023-05-061-0/+41
* lib/modules: Move class out of specialArgsRobert Hensing2023-05-061-3/+3
* 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 Hensing2023-05-062-0/+16
* 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 Hensing2023-05-061-0/+12
* lib/modules: Check against importing things with a _typeRobert Hensing2023-05-062-0/+8
* lib/modules: Add class concept to check imports•••This improves the error message when an incompatible module is imported. Robert Hensing2023-05-063-0/+42
* 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-014-0/+133
* 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-022-0/+6
* lib/tests/modules: Test doRenameorigin/doRename-no-warningRobert Hensing2022-11-032-0/+25
* lib/modules: Fix meta duplication in shorthand syntaxRobert Hensing2022-09-211-0/+19