treewide: use mkTarget (batch 3) (#1371)
Link: https://github.com/nix-community/stylix/pull/1371 Reviewed-by: pancho horrillo <pancho@pancho.name> Reviewed-by: Matt Sturgeon <matt@sturgeon.me.uk> Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
parent
ced2af0622
commit
aa5e3c0333
6 changed files with 270 additions and 249 deletions
|
|
@ -1,69 +1,70 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
mkTarget,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
mkTarget {
|
||||
name = "vim";
|
||||
humanName = "Vim";
|
||||
|
||||
let
|
||||
themeFile = config.lib.stylix.colors {
|
||||
templateRepo = config.stylix.inputs.base16-vim;
|
||||
target = "base16";
|
||||
};
|
||||
configElements = [
|
||||
(
|
||||
{ fonts }:
|
||||
{
|
||||
programs.vim.extraConfig = ''
|
||||
set guifont=${
|
||||
lib.escape [ " " ] fonts.monospace.name
|
||||
}:h${toString fonts.sizes.terminal}
|
||||
'';
|
||||
}
|
||||
)
|
||||
(
|
||||
{ colors, inputs }:
|
||||
{
|
||||
programs.vim = {
|
||||
plugins = [
|
||||
(pkgs.vimUtils.buildVimPlugin {
|
||||
name = "stylix";
|
||||
pname = "stylix";
|
||||
|
||||
themePlugin = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "stylix";
|
||||
pname = "stylix";
|
||||
src = colors {
|
||||
templateRepo = inputs.base16-vim;
|
||||
target = "base16";
|
||||
};
|
||||
dontUnpack = true;
|
||||
|
||||
src = themeFile;
|
||||
dontUnpack = true;
|
||||
buildPhase = ''
|
||||
install -D $src $out/colors/base16-stylix.vim
|
||||
'';
|
||||
})
|
||||
];
|
||||
extraConfig = with colors.withHashtag; ''
|
||||
set termguicolors
|
||||
colorscheme base16-stylix
|
||||
unlet g:colors_name
|
||||
|
||||
buildPhase = ''
|
||||
install -D $src $out/colors/base16-stylix.vim
|
||||
'';
|
||||
};
|
||||
|
||||
vimOptions =
|
||||
let
|
||||
inherit (config.stylix) fonts;
|
||||
in
|
||||
{
|
||||
plugins = [ themePlugin ];
|
||||
extraConfig = with config.lib.stylix.colors.withHashtag; ''
|
||||
set termguicolors
|
||||
colorscheme base16-stylix
|
||||
unlet g:colors_name
|
||||
|
||||
let g:stylix_colors = {
|
||||
\ 'base00': '${base00}',
|
||||
\ 'base01': '${base01}',
|
||||
\ 'base02': '${base02}',
|
||||
\ 'base03': '${base03}',
|
||||
\ 'base04': '${base04}',
|
||||
\ 'base05': '${base05}',
|
||||
\ 'base06': '${base06}',
|
||||
\ 'base07': '${base07}',
|
||||
\ 'base08': '${base08}',
|
||||
\ 'base09': '${base09}',
|
||||
\ 'base0A': '${base0A}',
|
||||
\ 'base0B': '${base0B}',
|
||||
\ 'base0C': '${base0C}',
|
||||
\ 'base0D': '${base0D}',
|
||||
\ 'base0E': '${base0E}',
|
||||
\ 'base0F': '${base0F}',
|
||||
\ }
|
||||
|
||||
set guifont=${
|
||||
lib.escape [ " " ] fonts.monospace.name
|
||||
}:h${toString fonts.sizes.terminal}
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
options.stylix.targets.vim.enable = config.lib.stylix.mkEnableTarget "Vim" true;
|
||||
|
||||
config = lib.mkIf (config.stylix.enable && config.stylix.targets.vim.enable) {
|
||||
programs.vim = vimOptions;
|
||||
};
|
||||
let g:stylix_colors = {
|
||||
\ 'base00': '${base00}',
|
||||
\ 'base01': '${base01}',
|
||||
\ 'base02': '${base02}',
|
||||
\ 'base03': '${base03}',
|
||||
\ 'base04': '${base04}',
|
||||
\ 'base05': '${base05}',
|
||||
\ 'base06': '${base06}',
|
||||
\ 'base07': '${base07}',
|
||||
\ 'base08': '${base08}',
|
||||
\ 'base09': '${base09}',
|
||||
\ 'base0A': '${base0A}',
|
||||
\ 'base0B': '${base0B}',
|
||||
\ 'base0C': '${base0C}',
|
||||
\ 'base0D': '${base0D}',
|
||||
\ 'base0E': '${base0E}',
|
||||
\ 'base0F': '${base0F}',
|
||||
\ }
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue