2023-02-03 15:42:45 +03:00
|
|
|
{
|
|
|
|
|
config,
|
|
|
|
|
lib,
|
|
|
|
|
...
|
2023-11-06 17:50:27 -07:00
|
|
|
}: let
|
2024-02-26 08:05:23 +03:00
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2025-03-10 11:56:50 +03:00
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
2023-11-06 17:50:27 -07:00
|
|
|
|
2023-02-03 15:42:45 +03:00
|
|
|
cfg = config.vim.dashboard.alpha;
|
2025-03-10 11:56:50 +03:00
|
|
|
themeDefined = cfg.theme != null;
|
|
|
|
|
layoutDefined = cfg.layout != [];
|
2023-02-03 15:42:45 +03:00
|
|
|
in {
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
vim.startPlugins = [
|
|
|
|
|
"alpha-nvim"
|
2023-02-27 17:53:09 +03:00
|
|
|
"nvim-web-devicons"
|
2023-02-03 15:42:45 +03:00
|
|
|
];
|
|
|
|
|
|
2025-03-10 11:56:50 +03:00
|
|
|
vim.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})
|
|
|
|
|
'';
|
2023-02-03 22:14:51 +03:00
|
|
|
|
2025-03-10 11:56:50 +03:00
|
|
|
assertions = [
|
|
|
|
|
{
|
|
|
|
|
assertion = themeDefined || layoutDefined;
|
|
|
|
|
message = ''
|
|
|
|
|
One of 'theme' or 'layout' should be defined in Alpha configuration.
|
|
|
|
|
'';
|
2023-02-03 22:14:51 +03:00
|
|
|
}
|
2025-03-10 11:56:50 +03:00
|
|
|
{
|
|
|
|
|
assertion = !(themeDefined && layoutDefined);
|
|
|
|
|
message = ''
|
|
|
|
|
'theme' and 'layout' cannot be defined at the same time.
|
|
|
|
|
'';
|
2023-02-03 22:14:51 +03:00
|
|
|
}
|
2025-03-10 11:56:50 +03:00
|
|
|
];
|
2023-02-03 15:42:45 +03:00
|
|
|
};
|
|
|
|
|
}
|