Skip to content

Commit

Permalink
lib/options: make mkPackageOption use mkNullOrOption'
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSturgeon committed Jun 1, 2024
1 parent 1bb4cb9 commit 297aa6d
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions lib/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 297aa6d

Please sign in to comment.