mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2026-05-14 21:58:05 +02:00
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ieb5bf983c05b1b13cd0e7133bc8998ba6a6a6964
45 lines
1 KiB
Nix
45 lines
1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
inherit (lib.modules) mkIf;
|
|
inherit (lib.nvim.lua) toLuaObject;
|
|
|
|
cfg = config.vim.dashboard.alpha;
|
|
themeDefined = cfg.theme != null;
|
|
layoutDefined = cfg.layout != [];
|
|
in {
|
|
config = mkIf cfg.enable {
|
|
vim = {
|
|
startPlugins = ["alpha-nvim"];
|
|
visuals.nvim-web-devicons.enable = true;
|
|
|
|
pluginRC.alpha = let
|
|
setupOpts =
|
|
if themeDefined
|
|
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
|
|
else {
|
|
inherit (cfg) layout opts;
|
|
};
|
|
in ''
|
|
require('alpha').setup(${toLuaObject setupOpts})
|
|
'';
|
|
};
|
|
|
|
assertions = [
|
|
{
|
|
assertion = themeDefined || layoutDefined;
|
|
message = ''
|
|
One of 'theme' or 'layout' should be defined in Alpha configuration.
|
|
'';
|
|
}
|
|
{
|
|
assertion = !(themeDefined && layoutDefined);
|
|
message = ''
|
|
'theme' and 'layout' cannot be defined at the same time.
|
|
'';
|
|
}
|
|
];
|
|
};
|
|
}
|