about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2023-06-11 20:27:54 +0200
committerpennae <github@quasiparticle.net>2023-06-13 16:56:32 +0200
commitd36f950d405369abca5144b14a201bc25c4a080a (patch)
tree1087a7b50343bfafd11efa2cfff9c5fc62ca0f73 /lib
parent20152b4269356ab04cab7b3c7b0df3fea3455637 (diff)
downloadnixlib-d36f950d405369abca5144b14a201bc25c4a080a.tar
nixlib-d36f950d405369abca5144b14a201bc25c4a080a.tar.gz
nixlib-d36f950d405369abca5144b14a201bc25c4a080a.tar.bz2
nixlib-d36f950d405369abca5144b14a201bc25c4a080a.tar.lz
nixlib-d36f950d405369abca5144b14a201bc25c4a080a.tar.xz
nixlib-d36f950d405369abca5144b14a201bc25c4a080a.tar.zst
nixlib-d36f950d405369abca5144b14a201bc25c4a080a.zip
lib: turn *MD functions into aliases
with docbook gone and MD the default these aren't needed any more. we
can't remove them yet because there's thousands of uses, but maybe some
day we can.
Diffstat (limited to 'lib')
-rw-r--r--lib/modules.nix19
-rw-r--r--lib/options.nix19
2 files changed, 14 insertions, 24 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index 4dc8c663b2fe..5821aeab20c7 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -1146,14 +1146,11 @@ let
     use = id;
   };
 
-  /* Transitional version of mkAliasOptionModule that uses MD docs. */
-  mkAliasOptionModuleMD = from: to: doRename {
-    inherit from to;
-    visible = true;
-    warn = false;
-    use = id;
-    markdown = true;
-  };
+  /* Transitional version of mkAliasOptionModule that uses MD docs.
+
+     This function is no longer necessary and merely an alias of `mkAliasOptionModule`.
+  */
+  mkAliasOptionModuleMD = mkAliasOptionModule;
 
   /* mkDerivedConfig : Option a -> (a -> Definition b) -> Definition b
 
@@ -1175,7 +1172,7 @@ let
       (opt.highestPrio or defaultOverridePriority)
       (f opt.value);
 
-  doRename = { from, to, visible, warn, use, withPriority ? true, markdown ? false }:
+  doRename = { from, to, visible, warn, use, withPriority ? true }:
     { config, options, ... }:
     let
       fromOpt = getAttrFromPath from options;
@@ -1186,9 +1183,7 @@ let
     {
       options = setAttrByPath from (mkOption {
         inherit visible;
-        description = if markdown
-          then lib.mdDoc "Alias of {option}`${showOption to}`."
-          else "Alias of <option>${showOption to}</option>.";
+        description = "Alias of {option}`${showOption to}`.";
         apply = x: use (toOf config);
       } // optionalAttrs (toType != null) {
         type = toType;
diff --git a/lib/options.nix b/lib/options.nix
index 11a3984aa47e..c42bc1e6c67e 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -100,10 +100,7 @@ rec {
     name: mkOption {
     default = false;
     example = true;
-    description =
-      if name ? _type && name._type == "mdDoc"
-      then lib.mdDoc "Whether to enable ${name.text}."
-      else "Whether to enable ${name}.";
+    description = "Whether to enable ${name}.";
     type = lib.types.bool;
   };
 
@@ -185,10 +182,10 @@ rec {
           (if isList example then "pkgs." + concatStringsSep "." example else example);
       });
 
-  /* Like mkPackageOption, but emit an mdDoc description instead of DocBook. */
-  mkPackageOptionMD = pkgs: name: extra:
-    let option = mkPackageOption pkgs name extra;
-    in option // { description = lib.mdDoc option.description; };
+  /* Alias of mkPackageOption. Previously used to create options with markdown
+     documentation, which is no longer required.
+  */
+  mkPackageOptionMD = mkPackageOption;
 
   /* This option accepts anything, but it does not produce any result.
 
@@ -347,11 +344,9 @@ rec {
   literalExample = lib.warn "literalExample is deprecated, use literalExpression instead, or use literalMD for a non-Nix description." literalExpression;
 
   /* Transition marker for documentation that's already migrated to markdown
-     syntax.
+     syntax. This is a no-op and no longer needed.
   */
-  mdDoc = text:
-    if ! isString text then throw "mdDoc expects a string."
-    else { _type = "mdDoc"; inherit text; };
+  mdDoc = lib.id;
 
   /* For use in the `defaultText` and `example` option attributes. Causes the
      given MD text to be inserted verbatim in the documentation, for when