mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 14:55:59 +01:00
modules/theme: switch to explicit lib calls
This commit is contained in:
parent
2101ac9061
commit
2c483d90af
3 changed files with 20 additions and 18 deletions
|
@ -1,9 +1,5 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
config,
|
inherit (lib.modules) mkDefault;
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkDefault;
|
|
||||||
in {
|
in {
|
||||||
config = {
|
config = {
|
||||||
vim.theme = {
|
vim.theme = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{...}: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./theme.nix
|
./theme.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
|
|
|
@ -3,44 +3,50 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkOption types attrNames mkIf nvim;
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.attrsets) attrNames;
|
||||||
|
inherit (lib.types) bool lines enum;
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.dag) entryBefore;
|
||||||
|
|
||||||
cfg = config.vim.theme;
|
cfg = config.vim.theme;
|
||||||
supported_themes = import ./supported_themes.nix {inherit lib;};
|
supported_themes = import ./supported_themes.nix {inherit lib;};
|
||||||
in {
|
in {
|
||||||
options.vim.theme = {
|
options.vim.theme = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
description = "Enable theming";
|
description = "Enable theming";
|
||||||
};
|
};
|
||||||
|
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = types.enum (attrNames supported_themes);
|
type = enum (attrNames supported_themes);
|
||||||
description = "Supported themes can be found in `supported_themes.nix`";
|
description = "Supported themes can be found in `supported_themes.nix`";
|
||||||
};
|
};
|
||||||
|
|
||||||
style = mkOption {
|
style = mkOption {
|
||||||
type = with types; enum supported_themes.${cfg.name}.styles;
|
type = enum supported_themes.${cfg.name}.styles;
|
||||||
description = "Specific style for theme if it supports it";
|
description = "Specific style for theme if it supports it";
|
||||||
};
|
};
|
||||||
|
|
||||||
transparent = mkOption {
|
transparent = mkOption {
|
||||||
type = with types; bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Whether or not transparency should be enabled. Has no effect for themes that do not support transparency";
|
description = "Whether or not transparency should be enabled. Has no effect for themes that do not support transparency";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = with types; lines;
|
type = lines;
|
||||||
description = "Additional lua configuration to add before setup";
|
description = "Additional lua configuration to add before setup";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [cfg.name];
|
vim = {
|
||||||
vim.luaConfigRC.themeSetup = nvim.dag.entryBefore ["theme"] cfg.extraConfig;
|
startPlugins = [cfg.name];
|
||||||
vim.luaConfigRC.theme = supported_themes.${cfg.name}.setup (with cfg; {
|
luaConfigRC = {
|
||||||
inherit style transparent;
|
themeSetup = entryBefore ["theme"] cfg.extraConfig;
|
||||||
});
|
theme = supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;});
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue