plugins/efmls: use mkPackageOption

This commit is contained in:
Matt Sturgeon 2024-09-03 16:15:48 +01:00
parent 2ef974182e
commit a8a7e405f4
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
3 changed files with 153 additions and 119 deletions

View file

@ -7,7 +7,7 @@
}:
let
tools = import ../../../generated/efmls-configs.nix;
inherit (import ./efmls-configs-pkgs.nix pkgs) packaged;
inherit (import ./efmls-configs-pkgs.nix lib) packaged;
in
{
options.plugins.efmls-configs = {
@ -26,10 +26,10 @@ in
toolPackages = lib.pipe packaged [
# Produce package a option for each tool
(lib.attrsets.mapAttrs (
tool: pkg:
helpers.mkPackageOption {
name = tool;
default = pkg;
name: loc:
lib.mkPackageOption pkgs name {
nullable = true;
default = loc;
}
))
# Filter package defaults that are not compatible with the current platform
@ -38,7 +38,7 @@ in
if lib.meta.availableOn pkgs.stdenv.hostPlatform opt.default then
opt
else
opt // { default = null; }
builtins.removeAttrs opt [ "defaultText" ] // { default = null; }
))
];