plugins/none-ls: use defaultText in package options

This commit is contained in:
Matt Sturgeon 2024-09-03 16:59:32 +01:00
parent a8a7e405f4
commit d2aad1071f
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
3 changed files with 219 additions and 168 deletions

View file

@ -8,8 +8,9 @@ sourceType: sourceName:
...
}:
let
inherit (import ./packages.nix pkgs) packaged;
inherit (import ./packages.nix lib) packaged;
pkg = packaged.${sourceName};
loc = lib.toList pkg;
cfg = config.plugins.none-ls;
cfg' = config.plugins.none-ls.sources.${sourceType}.${sourceName};
@ -55,7 +56,12 @@ in
''
));
}
// lib.optionalAttrs (pkg != null) { default = pkg; }
// lib.optionalAttrs (pkg != null) {
default =
lib.attrByPath loc (lib.warn "${lib.concatStringsSep "." loc} cannot be found in pkgs!" null)
pkgs;
defaultText = lib.literalExpression "pkgs.${lib.concatStringsSep "." loc}";
}
);
};