1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00

Merge pull request #230353 from ncfavier/defaultText-only

lib/options: fix rendering of options with only a defaultText
This commit is contained in:
Naïm Favier 2023-05-08 14:38:35 +02:00 committed by GitHub
commit 6674b8a6f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -261,7 +261,7 @@ rec {
concatMap (opt:
let
name = showOption opt.loc;
docOption = rec {
docOption = {
loc = opt.loc;
inherit name;
description = opt.description or null;
@ -280,9 +280,9 @@ rec {
renderOptionValue opt.example
);
}
// optionalAttrs (opt ? default) {
// optionalAttrs (opt ? defaultText || opt ? default) {
default =
builtins.addErrorContext "while evaluating the default value of option `${name}`" (
builtins.addErrorContext "while evaluating the ${if opt?defaultText then "defaultText" else "default value"} of option `${name}`" (
renderOptionValue (opt.defaultText or opt.default)
);
}