mirror of
https://github.com/danth/stylix
synced 2024-11-10 06:34:15 +00:00
Add Vim module
This commit is contained in:
parent
4ac0094a53
commit
536e20fdce
4 changed files with 59 additions and 0 deletions
|
@ -3,5 +3,6 @@
|
|||
./stylix/default.nix
|
||||
|
||||
./modules/console.nix
|
||||
./modules/vim.nix
|
||||
];
|
||||
}
|
||||
|
|
35
modules/vim.nix
Normal file
35
modules/vim.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ pkgs, config, ... }:
|
||||
|
||||
let
|
||||
base16-vim = pkgs.fetchFromGitHub {
|
||||
owner = "chriskempson";
|
||||
repo = "base16-vim";
|
||||
rev = "6191622d5806d4448fa2285047936bdcee57a098";
|
||||
sha256 = "6FsT87qcl9GBxgxrPx2bPULIMA/O8TRxHaN49qMM4uM=";
|
||||
};
|
||||
|
||||
themePlugin = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "stylix";
|
||||
|
||||
src = base16-vim;
|
||||
data = config.lib.stylix.base16.json;
|
||||
passAsFile = [ "data" ];
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out/colors
|
||||
${pkgs.mustache-go}/bin/mustache $dataPath \
|
||||
$src/templates/default.mustache > $out/colors/base16-stylix.vim
|
||||
'';
|
||||
};
|
||||
|
||||
vimOptions = {
|
||||
plugins = [ themePlugin ];
|
||||
extraConfig = "colorscheme base16-stylix";
|
||||
};
|
||||
|
||||
in {
|
||||
stylix.homeModule = {
|
||||
programs.vim = vimOptions;
|
||||
programs.neovim = vimOptions;
|
||||
};
|
||||
}
|
22
stylix/base16.nix
Normal file
22
stylix/base16.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Used to build templates from http://chriskempson.com/projects/base16/
|
||||
|
||||
{ pkgs, config, ... }:
|
||||
|
||||
{
|
||||
config.lib.stylix.base16 = rec {
|
||||
json = builtins.toJSON (config.lib.stylix.colors // {
|
||||
# Additional attributes only used for base16
|
||||
scheme-name = "Stylix";
|
||||
scheme-slug = "stylix";
|
||||
scheme-author = "Stylix";
|
||||
});
|
||||
|
||||
buildTemplate = name: templatePath:
|
||||
pkgs.runCommand "base16-${name}"
|
||||
{
|
||||
inherit json templatePath;
|
||||
passAsFile = [ "json" ];
|
||||
}
|
||||
"${pkgs.mustache-go}/bin/mustache $jsonPath $templatePath > $out";
|
||||
};
|
||||
}
|
|
@ -4,6 +4,7 @@ with lib;
|
|||
|
||||
{
|
||||
imports = [
|
||||
./base16.nix
|
||||
./colors.nix
|
||||
./fonts.nix
|
||||
./home-manager.nix
|
||||
|
|
Loading…
Reference in a new issue