mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-05 18:01:32 +00:00
dev: rebase on a less personalized neovim flake
This commit is contained in:
commit
9c00808863
70 changed files with 4910 additions and 0 deletions
11
modules/theme/config.nix
Normal file
11
modules/theme/config.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib; {
|
||||
config = {
|
||||
vim.theme = {
|
||||
enable = mkDefault false;
|
||||
name = mkDefault "onedark";
|
||||
style = mkDefault "darker";
|
||||
extraConfig = mkDefault "";
|
||||
};
|
||||
};
|
||||
}
|
11
modules/theme/default.nix
Normal file
11
modules/theme/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./theme.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
33
modules/theme/supported_themes.nix
Normal file
33
modules/theme/supported_themes.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
onedark = {
|
||||
setup = { style ? "dark" }: ''
|
||||
-- OneDark theme
|
||||
require('onedark').setup {
|
||||
style = "${style}"
|
||||
}
|
||||
require('onedark').load()
|
||||
'';
|
||||
styles = [ "dark" "darker" "cool" "deep" "warm" "warmer" ];
|
||||
};
|
||||
|
||||
tokyonight = {
|
||||
setup = { style ? "night" }: ''
|
||||
-- need to set style before colorscheme to apply
|
||||
vim.g.tokyonight_style = '${style}'
|
||||
vim.cmd[[colorscheme tokyonight]]
|
||||
'';
|
||||
styles = [ "day" "night" "storm" ];
|
||||
};
|
||||
|
||||
catppuccin = {
|
||||
setup = { style ? "mocha" }: ''
|
||||
-- Catppuccin theme
|
||||
require('catppuccin').setup {
|
||||
flavour = "${style}"
|
||||
}
|
||||
-- setup must be called before loading
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
'';
|
||||
styles = [ "latte" "frappe" "macchiato" "mocha" ];
|
||||
};
|
||||
}
|
40
modules/theme/theme.nix
Normal file
40
modules/theme/theme.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.attrsets;
|
||||
with builtins; let
|
||||
cfg = config.vim.theme;
|
||||
supported_themes = import ./supported_themes.nix;
|
||||
in {
|
||||
options.vim.theme = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
description = "Enable Theme";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.enum (attrNames supported_themes);
|
||||
description = "Supported themes can be found in `supported_themes.nix`";
|
||||
};
|
||||
|
||||
style = mkOption {
|
||||
type = with types; enum supported_themes.${cfg.name}.styles;
|
||||
description = "Specific style for theme if it supports it";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = with types; lines;
|
||||
description = "Additional lua configuration to add before setup";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [cfg.name];
|
||||
vim.luaConfigRC.themeSetup = nvim.dag.entryBefore ["theme"] cfg.extraConfig;
|
||||
vim.luaConfigRC.theme = supported_themes.${cfg.name}.setup {style = cfg.style;};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue