helpers: add mkPackageOption + refactoring

This commit is contained in:
Gaetan Lepage 2023-01-23 23:50:20 +01:00
parent 66b1b099cf
commit ff2be33445
58 changed files with 94 additions and 258 deletions

View file

@ -90,6 +90,12 @@ rec {
mkStr = default: mkNullable lib.types.str ''"${default}"'';
};
mkPackageOption = name: default: mkOption {
type = types.package;
inherit default;
description = "Plugin to use for ${name}";
};
mkPlugin = { config, lib, ... }: { name
, description
, package ? null
@ -110,11 +116,7 @@ rec {
options;
# does this evaluate package?
packageOption = if package == null then { } else {
package = mkOption {
type = types.package;
default = package;
description = "Plugin to use for ${name}";
};
package = mkPackageOption name package;
};
in
{