Add theme support to nixCats

This commit is contained in:
2025-11-30 18:51:56 +01:00
parent b73ba4dfa3
commit 383d8bd0c6
3 changed files with 113 additions and 56 deletions

View File

@@ -1,7 +1,19 @@
{ inputs, config, ... }: {
inputs,
lib,
config,
...
}:
let let
inherit (inputs.nixCats) utils; inherit (inputs.nixCats) utils;
luaPath = ./.; luaPath = ./.;
themeConfig =
config.theme.neovim or {
plugin = null;
setup = "";
};
categoryDefinitions = categoryDefinitions =
{ pkgs, ... }: { pkgs, ... }:
{ {
@@ -47,11 +59,13 @@ let
}; };
startupPlugins = { startupPlugins = {
general = with pkgs.vimPlugins; [ general =
lz-n with pkgs.vimPlugins;
plenary-nvim [
catppuccin-nvim lz-n
]; plenary-nvim
]
++ (lib.optional (themeConfig.plugin != null) themeConfig.plugin);
}; };
optionalPlugins = { optionalPlugins = {
@@ -86,7 +100,9 @@ let
render-markdown-nvim render-markdown-nvim
colorful-menu-nvim colorful-menu-nvim
]; ];
}; };
sharedLibraries = { sharedLibraries = {
@@ -132,6 +148,13 @@ let
nixos_options = ''(builtins.getFlake "path://${config.var.configDirectory}").nixosConfigurations.${toString config.var.hostname}.options''; nixos_options = ''(builtins.getFlake "path://${config.var.configDirectory}").nixosConfigurations.${toString config.var.hostname}.options'';
home_manager_options = ''(builtins.getFlake "path://${config.var.configDirectory}").nixosConfigurations.${toString config.var.hostname}.options.home-manager.users.type.getSubOptions []''; home_manager_options = ''(builtins.getFlake "path://${config.var.configDirectory}").nixosConfigurations.${toString config.var.hostname}.options.home-manager.users.type.getSubOptions []'';
}; };
themeSetup = themeConfig.setup;
# Pass only base00-base0F to neovim
stylixColors = lib.filterAttrs (
k: v: builtins.match "base0[0-9A-F]" k != null
) config.lib.stylix.colors.withHashtag;
}; };
}; };

View File

@@ -1,49 +1,73 @@
require("lz.n").load({ require("lz.n").load({
-- {
-- "catppuccin-nvim",
-- event = "VimEnter",
-- after = function()
-- require("catppuccin").setup({
-- flavour = "mocha",
-- term_colors = true,
-- dim_inactive = {
-- enabled = true,
-- shade = "dark",
-- percentage = 0.15,
-- },
-- integrations = {
-- gitsigns = true,
-- telescope = true,
-- treesitter = true,
-- treesitter_context = true,
-- markdown = true,
-- which_key = true,
-- blink_cmp = {
-- style = "bordered",
-- },
-- },
--
-- native_lsp = {
-- enabled = true,
-- virtual_text = {
-- errors = { "italic" },
-- hints = { "italic" },
-- warnings = { "italic" },
-- information = { "italic" },
-- },
-- underlines = {
-- errors = { "underline" },
-- hints = { "underline" },
-- warnings = { "underline" },
-- information = { "underline" },
-- },
-- inlay_hints = {
-- background = true,
-- },
-- },
-- })
--
-- vim.cmd.colorscheme("catppuccin")
-- end,
-- },
{ {
"catppuccin-nvim", "theme-loader",
event = "VimEnter", event = "VimEnter",
after = function() load = function()
require("catppuccin").setup({ local theme_code = nixCats.extra("themeSetup")
flavour = "mocha",
term_colors = true,
dim_inactive = {
enabled = true,
shade = "dark",
percentage = 0.15,
},
integrations = {
gitsigns = true,
telescope = true,
treesitter = true,
treesitter_context = true,
markdown = true,
which_key = true,
blink_cmp = {
style = "bordered",
},
},
native_lsp = { if theme_code and theme_code ~= "" then
enabled = true, local func, err = loadstring(theme_code)
virtual_text = { if func then
errors = { "italic" }, func()
hints = { "italic" }, else
warnings = { "italic" }, print("Error loading theme code: " .. err)
information = { "italic" }, end
}, else
underlines = { local colors = nixCats.extra("stylixColors")
errors = { "underline" }, if colors then
hints = { "underline" }, require("lz.n").trigger_load("mini.nvim")
warnings = { "underline" }, require("mini.base16").setup({
information = { "underline" }, palette = colors,
}, })
inlay_hints = { end
background = true, end
},
},
})
vim.cmd.colorscheme("catppuccin")
end, end,
}, },
{ {

View File

@@ -26,6 +26,16 @@
transparentButtons = false; transparentButtons = false;
floating = true; floating = true;
}; };
neovim = {
plugin = pkgs.vimPlugins.tokyonight-nvim;
setup = ''
require("tokyonight").setup({
style = "night"
})
vim.cmd.colorscheme("tokyonight")
'';
};
}; };
description = "Theme configuration options"; description = "Theme configuration options";
}; };
@@ -86,19 +96,19 @@
}; };
polarity = "dark"; polarity = "dark";
# image = pkgs.fetchurl { image = pkgs.fetchurl {
# url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/leef_dark_purple_minimalist.png"; url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/leef_dark_purple_minimalist.png";
# sha256 = "sha256-q6ufFdC/tMSb+mllw7XhilkAObemXXyps2SBlnMt7mY="; sha256 = "sha256-q6ufFdC/tMSb+mllw7XhilkAObemXXyps2SBlnMt7mY=";
# }; };
# image = pkgs.fetchurl { # image = pkgs.fetchurl {
# url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/alone-cloud_dark.png"; # url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/alone-cloud_dark.png";
# sha256 = "sha256-L4Esjo6LEwhBEN29WX445F+54rlnvOtAMKsQz8Qpyuc="; # sha256 = "sha256-L4Esjo6LEwhBEN29WX445F+54rlnvOtAMKsQz8Qpyuc=";
# }; # };
image = pkgs.fetchurl { # image = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/the-cloud-is-hidding-the-moon_dark.png"; # url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/the-cloud-is-hidding-the-moon_dark.png";
sha256 = "sha256-EEH2cHsVromD+X5VFF3YObNuSSRbDnpfqEN6fjCztbc="; # sha256 = "sha256-EEH2cHsVromD+X5VFF3YObNuSSRbDnpfqEN6fjCztbc=";
}; # };
}; };
} }