summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2016-08-28 13:55:28 +0200
committerGitHub <noreply@github.com>2016-08-28 13:55:28 +0200
commit4af09e00311b3c024395b59261a32a5a6a43e3fa (patch)
tree8b72eea81b13aa7ec016fe225f927fa579ff6b4f /lib/modules.nix
parent21f2f3074063017a6580fc1c5889ee54094160ff (diff)
parent16c923cef2152d58878abac023816f05605c1f7d (diff)
downloadnixlib-4af09e00311b3c024395b59261a32a5a6a43e3fa.tar
nixlib-4af09e00311b3c024395b59261a32a5a6a43e3fa.tar.gz
nixlib-4af09e00311b3c024395b59261a32a5a6a43e3fa.tar.bz2
nixlib-4af09e00311b3c024395b59261a32a5a6a43e3fa.tar.lz
nixlib-4af09e00311b3c024395b59261a32a5a6a43e3fa.tar.xz
nixlib-4af09e00311b3c024395b59261a32a5a6a43e3fa.tar.zst
nixlib-4af09e00311b3c024395b59261a32a5a6a43e3fa.zip
Merge pull request #14311 from Profpatsch/mkRemovedOptionModule-replacement
mkRemovedOptionModule: add replacement argument
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index e2fa3d7fbf0c..080974a61305 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -503,19 +503,25 @@ rec {
   /* Return a module that causes a warning to be shown if the
      specified option is defined. For example,
 
-       mkRemovedOptionModule [ "boot" "loader" "grub" "bootDevice" ]
+       mkRemovedOptionModule [ "boot" "loader" "grub" "bootDevice" ] "<replacement instructions>"
 
      causes a warning if the user defines boot.loader.grub.bootDevice.
+
+     replacementInstructions is a string that provides instructions on
+     how to achieve the same functionality without the removed option,
+     or alternatively a reasoning why the functionality is not needed.
+     replacementInstructions SHOULD be provided!
   */
-  mkRemovedOptionModule = optionName:
+  mkRemovedOptionModule = optionName: replacementInstructions:
     { options, ... }:
     { options = setAttrByPath optionName (mkOption {
         visible = false;
       });
       config.warnings =
         let opt = getAttrFromPath optionName options; in
-        optional opt.isDefined
-          "The option definition `${showOption optionName}' in ${showFiles opt.files} no longer has any effect; please remove it.";
+        optional opt.isDefined ''
+            The option definition `${showOption optionName}' in ${showFiles opt.files} no longer has any effect; please remove it.
+            ${replacementInstructions}'';
     };
 
   /* Return a module that causes a warning to be shown if the