mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-24 17:58:38 +02:00
plugins/none-ls: combine packaged+unpackaged lists
We can just make `packaged` nullable again.
This commit is contained in:
parent
d8f3113e90
commit
4f3cd9f368
3 changed files with 223 additions and 226 deletions
|
@ -8,7 +8,8 @@ sourceType: sourceName:
|
|||
...
|
||||
}:
|
||||
let
|
||||
inherit (import ./packages.nix pkgs) packaged unpackaged;
|
||||
inherit (import ./packages.nix pkgs) packaged;
|
||||
pkg = packaged.${sourceName};
|
||||
|
||||
cfg = config.plugins.none-ls;
|
||||
cfg' = config.plugins.none-ls.sources.${sourceType}.${sourceName};
|
||||
|
@ -22,27 +23,23 @@ in
|
|||
'';
|
||||
}
|
||||
# Only declare a package option if a package is required
|
||||
// lib.optionalAttrs (packaged ? ${sourceName} || lib.elem sourceName unpackaged) {
|
||||
package =
|
||||
let
|
||||
pkg = packaged.${sourceName} or null;
|
||||
in
|
||||
lib.mkOption (
|
||||
{
|
||||
type = lib.types.nullOr lib.types.package;
|
||||
description =
|
||||
"Package to use for ${sourceName}."
|
||||
+ (lib.optionalString (pkg == null) (
|
||||
"\n\n"
|
||||
+ ''
|
||||
Currently not packaged in nixpkgs.
|
||||
Either set this to `null` and install ${sourceName} outside of nix,
|
||||
or set this to a custom nix package.
|
||||
''
|
||||
));
|
||||
}
|
||||
// lib.optionalAttrs (pkg != null) { default = pkg; }
|
||||
);
|
||||
// lib.optionalAttrs (packaged ? ${sourceName}) {
|
||||
package = lib.mkOption (
|
||||
{
|
||||
type = lib.types.nullOr lib.types.package;
|
||||
description =
|
||||
"Package to use for ${sourceName}."
|
||||
+ (lib.optionalString (pkg == null) (
|
||||
"\n\n"
|
||||
+ ''
|
||||
Currently not packaged in nixpkgs.
|
||||
Either set this to `null` and install ${sourceName} outside of nix,
|
||||
or set this to a custom nix package.
|
||||
''
|
||||
));
|
||||
}
|
||||
// lib.optionalAttrs (pkg != null) { default = pkg; }
|
||||
);
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg.enable && cfg'.enable) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue