modules: add mkPackageOptionMD

another transitional option factory, like mkAliasOptionModuleMD.
This commit is contained in:
pennae 2022-12-30 21:04:52 +01:00 committed by pennae
parent 4c1cfbdb84
commit 9da5f12ecf
23 changed files with 42 additions and 24 deletions

View file

@ -136,7 +136,7 @@ rec {
let default' = if !isList default then [ default ] else default;
in mkOption {
type = lib.types.package;
description = lib.mdDoc "The ${name} package to use.";
description = "The ${name} package to use.";
default = attrByPath default'
(throw "${concatStringsSep "." default'} cannot be found in pkgs") pkgs;
defaultText = literalExpression ("pkgs." + concatStringsSep "." default');
@ -144,6 +144,11 @@ rec {
(if isList example then "pkgs." + concatStringsSep "." example else example);
};
/* Like mkPackageOption, but emit an mdDoc description instead of DocBook. */
mkPackageOptionMD = args: name: extra:
let option = mkPackageOption args name extra;
in option // { description = lib.mdDoc option.description; };
/* This option accepts anything, but it does not produce any result.
This is useful for sharing a module across different module sets