nichts/modules/editors/nvf/default.nix

40 lines
926 B
Nix
Raw Normal View History

2024-07-06 15:15:37 +02:00
{
2024-07-07 23:45:18 +02:00
pkgs,
2024-07-06 17:14:45 +02:00
config,
2024-07-06 15:53:16 +02:00
lib,
2024-07-06 17:14:45 +02:00
inputs,
2024-07-06 15:53:16 +02:00
...
2024-07-06 15:15:37 +02:00
}: let
2024-07-20 13:18:01 +02:00
cfg = config.modules.system.programs.editors.neovim;
2024-07-06 15:15:37 +02:00
inherit (builtins) filter map toString elem;
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.strings) hasSuffix;
2024-07-06 15:53:16 +02:00
inherit (lib.lists) concatLists;
2024-07-20 13:18:01 +02:00
inherit (lib) mkIf;
2024-07-06 15:15:37 +02:00
2024-07-06 15:53:16 +02:00
mkNeovimModule = {
path,
2024-07-08 00:13:37 +02:00
ignoredPaths ? [],
2024-07-06 15:15:37 +02:00
}:
filter (hasSuffix ".nix") (
map toString (
2024-07-07 23:45:18 +02:00
filter (path: path != ./default.nix && !elem path ignoredPaths) (listFilesRecursive path)
2024-07-06 15:53:16 +02:00
)
);
2024-07-06 15:15:37 +02:00
nvf = inputs.neovim-flake;
in {
2024-07-20 13:18:01 +02:00
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
typstyle
];
imports = concatLists [
# neovim-flake home-manager module
[nvf.nixosModules.default]
# construct this entire directory as a module
# which means all default.nix files will be imported automtically
(mkNeovimModule {path = ./.;})
];
};
2024-07-06 15:53:16 +02:00
}