Why attribute names in themer are written as strings? #341
-
themer = with pkgs.vimPlugins;
(builtins.getAttr (categories.colorscheme or "onedark") {
# Theme switcher without creating a new category
"onedark" = onedark-nvim;
"catppuccin" = catppuccin-nvim;
"catppuccin-mocha" = catppuccin-nvim;
"tokyonight" = tokyonight-nvim;
"tokyonight-day" = tokyonight-nvim;
}
); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Its an example, not something built into nixCats. Feel free to delete it from your config if you don't like it by the way. It shows how you can use values from your packageDefintiions within your categoryDefinitions. For example the categories set or the setting set are all things you have access to there. In this case, themer = with pkgs.vimPlugins; # <- make a new category of stuff to install called themer
(builtins.getAttr (categories.colorscheme or "onedark") { # <- we will grab categories.colorscheme from our packageDefinition
"onedark" = onedark-nvim; # <- and we install the package corresponding with whatever was in categories.colorscheme, assuming any matched.
"catppuccin" = catppuccin-nvim;
"catppuccin-mocha" = catppuccin-nvim;
"tokyonight" = tokyonight-nvim;
"tokyonight-day" = tokyonight-nvim;
}
);It is not installing the string but rather the package associated with that string via the table there. Also I may have misunderstood, so, to cover my bases, if by "written as strings" you mean why does it not look like this themer = with pkgs.vimPlugins; # <- make a new category of stuff to install called themer
(builtins.getAttr (categories.colorscheme or "onedark") { # <- we will grab categories.colorscheme from our packageDefinition
onedark = onedark-nvim; # <- and we install the package corresponding with whatever was in categories.colorscheme, assuming any matched.
catppuccin = catppuccin-nvim;
catppuccin-mocha = catppuccin-nvim;
tokyonight = tokyonight-nvim;
tokyonight-day = tokyonight-nvim;
}
);Then the answer is mostly just "because" tbh. Because they are being compared against a string using getAttr so it felt right. |
Beta Was this translation helpful? Give feedback.
Its an example, not something built into nixCats. Feel free to delete it from your config if you don't like it by the way.
It shows how you can use values from your packageDefintiions within your categoryDefinitions.
For example the categories set or the setting set are all things you have access to there.
In this case,