mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
Add support for automatically importing any directories under `plugins/by-name`. Includes a validation test, which is run by CI and by the pre-commit hook.
17 lines
400 B
Nix
17 lines
400 B
Nix
{ lib, ... }:
|
|
let
|
|
inherit (builtins) readDir pathExists;
|
|
inherit (lib.attrsets) foldlAttrs;
|
|
inherit (lib.lists) optional optionals;
|
|
by-name = ../plugins/by-name;
|
|
in
|
|
{
|
|
imports =
|
|
[ ../plugins ]
|
|
++ optionals (pathExists by-name) (
|
|
foldlAttrs (
|
|
prev: name: type:
|
|
prev ++ optional (type == "directory") (by-name + "/${name}")
|
|
) [ ] (readDir by-name)
|
|
);
|
|
}
|