about summary refs log tree commit diff
path: root/nixos/doc/manual/development/replace-modules.section.md
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-01-21 00:58:47 +0100
committerRobert Hensing <robert@roberthensing.nl>2023-03-01 15:03:44 +0100
commit118bdf25a6c572dd2fd29d10b1ae2e4d9a95b907 (patch)
treecc6cf8beac44afd968048edc568bd2ffe9bcd5b7 /nixos/doc/manual/development/replace-modules.section.md
parent82b4c24705340bceed0d463d3d897b6ebcbd7550 (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 'nixos/doc/manual/development/replace-modules.section.md')
-rw-r--r--nixos/doc/manual/development/replace-modules.section.md11
1 files changed, 9 insertions, 2 deletions
diff --git a/nixos/doc/manual/development/replace-modules.section.md b/nixos/doc/manual/development/replace-modules.section.md
index 0c0d6a7ac2f19..ac9f5adbaf981 100644
--- a/nixos/doc/manual/development/replace-modules.section.md
+++ b/nixos/doc/manual/development/replace-modules.section.md
@@ -8,8 +8,15 @@ the system on a stable release.
 
 `disabledModules` is a top level attribute like `imports`, `options` and
 `config`. It contains a list of modules that will be disabled. This can
-either be the full path to the module or a string with the filename
-relative to the modules path (eg. \<nixpkgs/nixos/modules> for nixos).
+either be:
+ - the full path to the module,
+ - or a string with the filename relative to the modules path (eg. \<nixpkgs/nixos/modules> for nixos),
+ - or an attribute set containing a specific `key` attribute.
+
+The latter allows some modules to be disabled, despite them being distributed
+via attributes instead of file paths. The `key` should be globally unique, so
+it is recommended to include a file path in it, or rely on a framework to do it
+for you.
 
 This example will replace the existing postgresql module with the
 version defined in the nixos-unstable channel while keeping the rest of