about summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorKevin Cox <kevincox@kevincox.ca>2022-03-21 10:10:40 -0400
committerGitHub <noreply@github.com>2022-03-21 10:10:40 -0400
commit8ce16fcf62095c4a0faab25f27dc3698214ad6c6 (patch)
tree2885b15250fc611a913d12b929406050a5508c90 /lib/modules.nix
parent84569e8d3c6927afdd942c19be415fa5a6dfa864 (diff)
parent1eb627c4cf62f50b647d2bf287d1ea97e326539f (diff)
Merge pull request #163451 from hercules-ci/stop-premature-warnings
Stop premature warnings, including `nix.settings` migration
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index 01ba914ca80ef..9bb8bfbbdf144 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -954,6 +954,26 @@ rec {
     use = builtins.trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'.";
   };
 
+  mkRenamedOptionModuleWith = {
+    /* Old option path as list of strings. */
+    from,
+    /* New option path as list of strings. */
+    to,
+
+    /*
+      Release number of the first release that contains the rename, ignoring backports.
+      Set it to the upcoming release, matching the nixpkgs/.version file.
+    */
+    sinceRelease,
+
+  }: doRename {
+    inherit from to;
+    visible = false;
+    warn = lib.isInOldestRelease sinceRelease;
+    use = lib.warnIf (lib.isInOldestRelease sinceRelease)
+      "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'.";
+  };
+
   /* Return a module that causes a warning to be shown if any of the "from"
      option is defined; the defined values can be used in the "mergeFn" to set
      the "to" value.