about summary refs log tree commit diff
path: root/lib/tests/modules
Commit message (Collapse)AuthorAge
* Avoid top-level `with ...;` in ↵Philip Taron2024-03-11
| | | | lib/tests/modules/extendModules-168767-imports.nix
* Avoid top-level `with ...;` in lib/tests/modules/alias-with-priority.nixPhilip Taron2024-03-11
|
* Avoid top-level `with ...;` in ↵Philip Taron2024-03-11
| | | | lib/tests/modules/alias-with-priority-can-override.nix
* Merge pull request #284512 from hercules-ci/lib-types-unique-mergeSilvan Mosberger2024-02-10
|\ | | | | lib.types.unique: Check inner type deeply
| * lib.types.unique: Check inner type deeplyRobert Hensing2024-01-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | lib.modules.doRename: Add condition parameterRobert Hensing2024-02-02
| | | | | | | | | | This is to support single-to-multi service migrations, so that the `to` (e.g. `foos.""`) isn't defined unconditionally. See test cases.
* | feat: add test for nonEmptyListOf submoduleDanila Danko2024-01-30
|/
* lib: `modules.sh` should check JSON output for predictabilityRebecca Turner2023-12-19
| | | | | | | | | 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.
* Merge pull request #272709 from hercules-ci/module-system-test-pr-131205Maximilian Bosch2023-12-10
|\ | | | | lib/modules: Test optionless module errors from #131205
| * lib/modules: Test optionless module errors from #131205Robert Hensing2023-12-09
| |
* | lib.types.boolByOr: initSilvan Mosberger2023-12-08
|/ | | | | | | This type is necessary to have correct merging behavior for `allowUnfreePredicate` and `allowInsecurePredicate` Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
* lib/tests: add test for pkgsText parameter and package set selection of ↵Anselm Schüler2023-10-10
| | | | mkPackageOption
* lib/tests: add more tests for mkPackageOptionAnselm Schüler2023-10-06
|
* lib.gvariant: make the tests really worklinsui2023-09-28
|
* Merge pull request #249243 from lf-/jade/declarationsWithLocationsRobert Hensing2023-09-17
|\ | | | | nixos/modules: Add declarationPositions
| * nixos/modules: Add declarationPositionsJade Lovelace2023-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | lib/gvariant: initlinsui2023-08-15
| |
* | lib/modules: Report a good error when option tree has bare typeRobert Hensing2023-08-14
|/ | | | | Note that this removes the possibility of declaring an option named `_type`.
* Merge pull request #243139 from hercules-ci/modules-test-default-argumentRobert Hensing2023-08-02
|\ | | | | lib/tests/modules: Test that _module.args works when a default argume…
| * lib/tests/modules: Test that _module.args works when a default argument is setRobert Hensing2023-07-12
| |
* | Merge pull request #245271 from sternenseemann/module-system-merge-no-typeRobert Hensing2023-07-27
|\ \ | |/ |/| lib/modules: handle typeless options in mergeModules
| * lib/modules: handle typeless options in mergeModulessternenseemann2023-07-26
| | | | | | | | | | | | 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.
* | lib/tests: invalidate hashesNaïm Favier2023-07-05
|/ | | | | | 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
* lib/tests/modules.sh: Test types.pathInStoreRobert Hensing2023-06-27
| | | | | Add missing test cases. I think the .links case should be rejected even though it's technically a path in the store.
* lib.modules: Add mergeAttrDefinitionsWithPrioRobert Hensing2023-06-16
| | | | | | 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.
* lib/tests: add mkPackageOption testsNaïm Favier2023-05-20
|
* lib.modules: Change class declaration in module to _classRobert Hensing2023-05-06
|
* lib/tests/modules.sh: Add submodule + class testsRobert Hensing2023-05-06
|
* lib/modules: Move class out of specialArgsRobert Hensing2023-05-06
|
* lib/modules: Only interpret class declaration in non-shorthand modeRobert Hensing2023-05-06
| | | | | | 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.
* lib/modules: Improve error when a configuration is importedRobert Hensing2023-05-06
| | | | | | 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.
* lib/modules: Check against importing things with a _typeRobert Hensing2023-05-06
|
* lib/modules: Add class concept to check importsRobert Hensing2023-05-06
| | | | | This improves the error message when an incompatible module is imported.
* lib/modules: Allow an "anonymous" module with key in disabledModulesRobert Hensing2023-03-01
| | | | | | | | | | | | | | | | | 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).
* lib/modules: Add context to the "option does not exist" errorRobert Hensing2022-12-02
| | | | | | | 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`.
* lib/tests/modules: Test doRenameRobert Hensing2022-11-03
|
* lib/modules: Fix meta duplication in shorthand syntaxRobert Hensing2022-09-21
|
* lib.modules: support strings with absolute paths in `disabledModules`Erik Arvstedt2022-08-31
| | | | | | | | | 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.
* lib/modules: Throw earlier when module function does not return attrsRobert Hensing2022-06-14
| | | | | | | `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.
* lib.deferredModule: Make it properly singularRobert Hensing2022-06-14
|
* lib.types.deferredModule: Allow path-typed module referencesRobert Hensing2022-06-14
|
* lib/test/modules.sh: Test deferredModule error location fileRobert Hensing2022-06-14
|
* lib.types: Add deferredModuleRobert Hensing2022-06-14
|
* lib/tests: Add submodule file propagation testSilvan Mosberger2022-06-14
|
* lib/tests/modules: Test functionTo submodule merging tooRobert Hensing2022-05-13
|
* lib.types.functionTo: Support type mergingRobert Hensing2022-05-13
|
* lib.types.submoduleWith: Avoid _key collisions after extendModulesRobert Hensing2022-04-24
|
* Merge pull request #156533 from ↵Silvan Mosberger2022-03-16
|\ | | | | | | | | hercules-ci/issue-146882-transparent-submodule-options lib.modules: Let module declare options directly in bare submodule
| * lib/tests/modules: Add test case for duplicate option error file locationRobert Hensing2022-03-07
| |
| * lib.modules: Make option injection work when shorthandOnlyDefinesConfigRobert Hensing2022-03-03
| |