From 3a4701da139a5576e94896ed2615c43e6a8c0a6d Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 31 May 2024 17:28:31 +0100 Subject: [PATCH] lib/options: make `mkPackageOption` use `mkNullOrOption'` --- lib/options.nix | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/options.nix b/lib/options.nix index b1152eacf0..6e8d5cd965 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -248,23 +248,25 @@ rec { mkPackageOption = { - name ? null, # Can be null if a custom description is given. - default, + name ? null, # Can be omitted if a custom description is given. description ? null, - example ? null, - }: - mkOption { - type = with types; nullOr package; - inherit default example; - description = - if description == null then - '' - Which package to use for `${name}`. - Set to `null` to disable its automatic installation. - '' - else - description; - }; + default, # `default` is not optional + ... + }@args: + mkNullOrOption' ( + (filterAttrs (n: _: n != "name") args) + // { + type = types.package; + description = + if description == null then + '' + Which package to use for `${name}`. + Set to `null` to disable its automatic installation. + '' + else + description; + } + ); mkPluginPackageOption = name: default: