mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins/by-name: init
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.
This commit is contained in:
parent
6df273540c
commit
faff32b9f1
5 changed files with 186 additions and 9 deletions
|
@ -1,4 +1,17 @@
|
|||
{ ... }:
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (builtins) readDir pathExists;
|
||||
inherit (lib.attrsets) foldlAttrs;
|
||||
inherit (lib.lists) optional optionals;
|
||||
by-name = ../plugins/by-name;
|
||||
in
|
||||
{
|
||||
imports = [ ../plugins/default.nix ];
|
||||
imports =
|
||||
[ ../plugins ]
|
||||
++ optionals (pathExists by-name) (
|
||||
foldlAttrs (
|
||||
prev: name: type:
|
||||
prev ++ optional (type == "directory") (by-name + "/${name}")
|
||||
) [ ] (readDir by-name)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue