2023-02-01 20:11:37 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 01:50:27 +01:00
|
|
|
}: let
|
2024-03-12 01:47:12 +01:00
|
|
|
inherit (lib.options) mkOption;
|
|
|
|
inherit (lib.attrsets) attrNames;
|
|
|
|
inherit (lib.types) bool lines enum;
|
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
inherit (lib.nvim.dag) entryBefore;
|
2023-11-07 01:50:27 +01:00
|
|
|
|
2023-02-01 20:11:37 +01:00
|
|
|
cfg = config.vim.theme;
|
2024-05-23 15:51:05 +02:00
|
|
|
supported_themes = import ./supported_themes.nix {
|
|
|
|
inherit lib config;
|
|
|
|
};
|
2023-02-01 20:11:37 +01:00
|
|
|
in {
|
|
|
|
options.vim.theme = {
|
|
|
|
enable = mkOption {
|
2024-03-12 01:47:12 +01:00
|
|
|
type = bool;
|
2023-04-02 18:58:57 +02:00
|
|
|
description = "Enable theming";
|
2023-02-01 20:11:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
name = mkOption {
|
2024-03-12 01:47:12 +01:00
|
|
|
type = enum (attrNames supported_themes);
|
2023-02-01 20:11:37 +01:00
|
|
|
description = "Supported themes can be found in `supported_themes.nix`";
|
|
|
|
};
|
|
|
|
|
|
|
|
style = mkOption {
|
2024-03-12 01:47:12 +01:00
|
|
|
type = enum supported_themes.${cfg.name}.styles;
|
2023-02-01 20:11:37 +01:00
|
|
|
description = "Specific style for theme if it supports it";
|
|
|
|
};
|
|
|
|
|
2023-04-11 12:57:47 +02:00
|
|
|
transparent = mkOption {
|
2024-03-12 01:47:12 +01:00
|
|
|
type = bool;
|
2023-04-11 12:57:47 +02:00
|
|
|
default = false;
|
|
|
|
description = "Whether or not transparency should be enabled. Has no effect for themes that do not support transparency";
|
|
|
|
};
|
|
|
|
|
2023-02-01 20:11:37 +01:00
|
|
|
extraConfig = mkOption {
|
2024-03-12 01:47:12 +01:00
|
|
|
type = lines;
|
2023-02-01 20:11:37 +01:00
|
|
|
description = "Additional lua configuration to add before setup";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-03-12 01:47:12 +01:00
|
|
|
vim = {
|
|
|
|
startPlugins = [cfg.name];
|
|
|
|
luaConfigRC = {
|
|
|
|
themeSetup = entryBefore ["theme"] cfg.extraConfig;
|
|
|
|
theme = supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;});
|
|
|
|
};
|
|
|
|
};
|
2023-02-01 20:11:37 +01:00
|
|
|
};
|
|
|
|
}
|