nvf/modules/plugins/dashboard/alpha/config.nix
NotAShelf 1c0c41e8f5
treewide: use the module option for nvim-web-devicons instead of startPlugins
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I7156c980edc28aded12df0d483c217486a6a6964
2026-02-15 12:25:59 +03:00

43 lines
1,002 B
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;
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})
'';
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.
'';
}
];
};
}