marleyvim/packages/neovim/default.nix

67 lines
1.4 KiB
Nix
Raw Normal View History

2024-11-25 17:47:14 -08:00
{
lib,
pkgs,
inputs,
neovim-settings ? {},
neovim-config ? {},
...
}: let
2024-11-22 16:59:44 -08:00
raw-modules = lib.snowfall.fs.get-default-nix-files-recursive (
lib.snowfall.fs.get-file "/modules/nixvim"
);
2024-11-25 17:47:14 -08:00
wrapped-modules =
builtins.map
2024-11-22 16:59:44 -08:00
(
2024-11-25 17:47:14 -08:00
raw-module: args: let
2024-11-22 16:59:44 -08:00
module = import raw-module;
result =
2024-11-25 17:47:14 -08:00
if builtins.isFunction module
then
2024-11-22 16:59:44 -08:00
module
2024-11-25 17:47:14 -08:00
(
args
// {
# NOTE: nixvim doesn't allow for these to be customized so we must work around the
# module system here...
inherit lib pkgs;
}
)
else module;
2024-11-22 16:59:44 -08:00
in
2024-11-25 17:47:14 -08:00
result // {_file = raw-module;}
2024-11-22 16:59:44 -08:00
)
raw-modules;
raw-neovim = pkgs.nixvim.makeNixvimWithModule {
inherit pkgs;
module = {
imports = wrapped-modules;
config = lib.mkMerge [
{
_module.args = {
settings = neovim-settings;
lib = lib.mkForce lib;
};
}
neovim-config
];
};
};
neovim = raw-neovim.overrideAttrs (attrs: {
2024-11-25 17:47:14 -08:00
meta =
attrs.meta
// {
# NOTE: The default platforms specified aren't actually all
# supported by nixvim. Instead, only support the ones that can build with
# the module system.
platforms = builtins.attrNames inputs.nixvim.legacyPackages;
};
2024-11-22 16:59:44 -08:00
});
in
2024-11-25 17:47:14 -08:00
neovim