nvf/modules/utility/images/image-nvim/config.nix

38 lines
877 B
Nix
Raw Normal View History

2024-02-17 00:19:38 +00:00
{
config,
lib,
pkgs,
2024-02-17 00:19:38 +00:00
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
2024-02-17 00:19:38 +00:00
cfg = config.vim.utility.images.image-nvim;
in {
config = mkIf cfg.enable {
assertions = [
{
assertion = pkgs.stdenv.isDarwin && cfg.setupOpts.backend != "ueberzug";
message = "image-nvim: ueberzug backend is broken on ${pkgs.stdenv.hostPlatform.system}. if you are using kitty, please set `vim.utility.images.image-nvim.setupOpts.backend` option to `kitty` in your configuration, otherwise disable this module.";
}
];
2024-02-17 00:19:38 +00:00
vim = {
startPlugins = [
"image-nvim"
];
luaPackages = [
"magick"
];
2024-02-17 00:19:38 +00:00
luaConfigRC.image-nvim = entryAnywhere ''
2024-02-17 00:19:38 +00:00
require("image").setup(
${toLuaObject cfg.setupOpts}
2024-02-17 00:19:38 +00:00
)
'';
};
};
}