diff options
author | Robert Hensing <robert@roberthensing.nl> | 2023-01-21 00:58:47 +0100 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2023-03-01 15:03:44 +0100 |
commit | 118bdf25a6c572dd2fd29d10b1ae2e4d9a95b907 (patch) | |
tree | cc6cf8beac44afd968048edc568bd2ffe9bcd5b7 /lib/tests/modules/disable-module-bad-key.nix | |
parent | 82b4c24705340bceed0d463d3d897b6ebcbd7550 (diff) |
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).
Diffstat (limited to 'lib/tests/modules/disable-module-bad-key.nix')
-rw-r--r-- | lib/tests/modules/disable-module-bad-key.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/tests/modules/disable-module-bad-key.nix b/lib/tests/modules/disable-module-bad-key.nix new file mode 100644 index 0000000000000..f50d06f2f03cd --- /dev/null +++ b/lib/tests/modules/disable-module-bad-key.nix @@ -0,0 +1,16 @@ +{ lib, ... }: +let + inherit (lib) mkOption types; + + moduleWithKey = { config, ... }: { + config = { + enable = true; + }; + }; +in +{ + imports = [ + ./declare-enable.nix + ]; + disabledModules = [ { } ]; +} |