diff --git a/flake.nix b/flake.nix index fb7d4c94..b2b48c18 100644 --- a/flake.nix +++ b/flake.nix @@ -1,13 +1,11 @@ { description = "A neovim configuration system for NixOS"; - inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable; - inputs.neovim-nightly.url = github:nix-community/neovim-nightly-overlay; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.neovim-nightly.url = "github:nix-community/neovim-nightly-overlay"; outputs = { self, nixpkgs, ... }@inputs: rec { - overlays = [ - inputs.neovim-nightly.overlay - ]; + overlays = [ inputs.neovim-nightly.overlay ]; nixosModules.nixvim = import ./nixvim.nix { nixos = true; }; homeManagerModules.nixvim = import ./nixvim.nix { homeManager = true; }; @@ -26,22 +24,16 @@ password = ""; }; - imports = [ - nixosModules.nixvim - ]; + imports = [ nixosModules.nixvim ]; nixpkgs.overlays = [ inputs.neovim-nightly.overlay ]; programs.nixvim = { enable = true; package = pkgs.neovim-nightly; - colorschemes.onedark = { - enable = true; - }; + colorschemes.tokyonight = { enable = true; }; - extraPlugins = [ - pkgs.vimPlugins.vim-nix - ]; + extraPlugins = [ pkgs.vimPlugins.vim-nix ]; options = { number = true; @@ -58,9 +50,8 @@ maps.normalVisualOp."รง" = ":"; - plugins.airline = { + plugins.lualine = { enable = true; - powerline = true; }; plugins.undotree.enable = true; @@ -83,14 +74,10 @@ plugins.telescope = { enable = true; - extensions = { - frecency.enable = true; - }; + extensions = { frecency.enable = true; }; }; - plugins.nvim-autopairs = { - enable = true; - }; + plugins.nvim-autopairs = { enable = true; }; globals = { vimsyn_embed = "l"; diff --git a/plugins/colorschemes/tokyonight.nix b/plugins/colorschemes/tokyonight.nix new file mode 100644 index 00000000..8178e64f --- /dev/null +++ b/plugins/colorschemes/tokyonight.nix @@ -0,0 +1,59 @@ +{ pkgs, config, lib, ... }: +with lib; +let + cfg = config.programs.nixvim.colorschemes.tokyonight; + style = types.enum [ "storm" "night" "day" ]; +in { + options = { + programs.nixvim.colorschemes.tokyonight = { + enable = mkEnableOption "Enable tokyonight"; + style = mkOption { + type = types.nullOr style; + default = null; + description = "Theme style"; + }; + terminalColors = mkEnableOption + "Configure the colors used when opening a :terminal in Neovim"; + italicComments = mkEnableOption "Make comments italic"; + italicKeywods = mkEnableOption "Make keywords italic"; + italicFunctions = mkEnableOption "Make functions italic"; + italicVariables = mkEnableOption "Make variables and identifiers italic"; + transparent = + mkEnableOption "Enable this to disable setting the background color"; + hideInactiveStatusline = mkEnableOption + "Enabling this option will hide inactive statuslines and replace them with a thin border"; + transparentSidebar = mkEnableOption + "Sidebar like windows like NvimTree get a transparent background"; + darkSidebar = mkEnableOption + "Sidebar like windows like NvimTree get a darker background"; + darkFloat = mkEnableOption + "Float windows like the lsp diagnostics windows get a darker background"; + lualineBold = mkEnableOption + "When true, section headers in the lualine theme will be bold"; + }; + }; + config = mkIf cfg.enable { + programs.nixvim = { + colorscheme = "tokyonight"; + extraPlugins = [ pkgs.vimPlugins.tokyonight-nvim ]; + options = { termguicolors = true; }; + globals = { + tokyonight_style = mkIf (!isNull cfg.style) cfg.style; + tokyonight_terminal_colors = mkIf (!cfg.terminalColors) 0; + + tokyonight_italic_comments = mkIf (!cfg.italicComments) 0; + tokyonight_italic_keywords = mkIf (!cfg.italicKeywods) 0; + tokyonight_italic_functions = mkIf (cfg.italicFunctions) 1; + tokyonight_italic_variables = mkIf (cfg.italicVariables) 1; + + tokyonight_transparent = mkIf (cfg.transparent) 1; + tokyonight_hide_inactive_statusline = + mkIf (cfg.hideInactiveStatusline) 1; + tokyonight_transparent_sidebar = mkIf (cfg.transparentSidebar) 1; + tokyonight_dark_sidebar = mkIf (!cfg.darkSidebar) 0; + tokyonight_dark_float = mkIf (!cfg.darkFloat) 0; + tokyonight_lualine_bold = mkIf (cfg.lualineBold) 1; + }; + }; + }; +} diff --git a/plugins/default.nix b/plugins/default.nix index 6efc2ff5..c4d3d81b 100644 --- a/plugins/default.nix +++ b/plugins/default.nix @@ -4,11 +4,13 @@ ./colorschemes/onedark.nix ./colorschemes/one.nix ./colorschemes/base16.nix + ./colorschemes/tokyonight.nix ./pluginmanagers/packer.nix ./statuslines/lightline.nix ./statuslines/airline.nix + ./statuslines/lualine.nix ./git/gitgutter.nix ./git/fugitive.nix diff --git a/plugins/statuslines/lualine.nix b/plugins/statuslines/lualine.nix new file mode 100644 index 00000000..5f0f6aa6 --- /dev/null +++ b/plugins/statuslines/lualine.nix @@ -0,0 +1,131 @@ +{ pkgs, config, lib, ... }: +with lib; +let + cfg = config.programs.nixvim.plugins.lualine; + helpers = import ../helpers.nix { lib = lib; }; + separators = mkOption { + type = types.submodule { + options = { + left = mkOption { + default = " "; + type = types.str; + description = "left separator"; + }; + right = mkOption { + default = " "; + type = types.str; + description = "right separator"; + }; + }; + }; + default = { }; + }; + component_options = mode: + mkOption { + type = types.submodule { + options = { + mode = mkOption { + type = types.str; + default = "${mode}"; + }; + icons_enabled = mkOption { + type = types.enum [ "True" "False" ]; + default = "True"; + description = "displays icons in alongside component"; + }; + icon = mkOption { + type = types.nullOr types.str; + default = null; + description = "displays icon in front of the component"; + }; + separator = separators; + }; + }; + default = { }; + }; +in { + options = { + programs.nixvim.plugins.lualine = { + enable = mkEnableOption "Enable lualine"; + + theme = mkOption { + default = "auto"; + type = types.str; + description = "The theme to use for lualine-nvim."; + }; + + sectionSeparators = separators; + componentSeparators = separators; + + disabledFilestypes = mkOption { + type = types.listOf types.str; + default = [ ]; + example = ''[ "lua" ]''; + description = "filetypes to disable lualine on"; + }; + + alwaysDivideMiddle = mkOption { + type = types.bool; + default = true; + description = "When true, left_sections (a,b,c) can't take over entire statusline"; + }; + + sections = mkOption { + type = types.nullOr (types.submodule ({ ... }: { + options = { + lualine_a = component_options "mode"; + lualine_b = component_options "branch"; + lualine_c = component_options "filename"; + + lualine_x = component_options "encoding"; + lualine_y = component_options "progress"; + lualine_z = component_options "location"; + }; + })); + + default = { }; + }; + + tabline = mkOption { + type = types.nullOr (types.submodule ({ ... }: { + options = { + lualine_a = component_options ""; + lualine_b = component_options ""; + lualine_c = component_options ""; + + lualine_x = component_options ""; + lualine_y = component_options ""; + lualine_z = component_options ""; + }; + })); + default = null; + }; + extensions = mkOption { + type = types.listOf types.str; + default = [ ]; + example = ''[ "fzf" ]''; + description = "list of enabled extensions"; + }; + }; + }; + config = let + setupOptions = { + options = { + theme = cfg.theme; + section_separators = cfg.sectionSeparators; + component_separators = cfg.componentSeparators; + disabled_filestypes = cfg.disabledFilestypes; + always_divide_middle = cfg.alwaysDivideMiddle; + }; + + sections = cfg.sections; + tabline = cfg.tabline; + extensions = cfg.extensions; + }; + in mkIf cfg.enable { + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.lualine-nvim ]; + extraConfigLua = ''require("lualine").setup(${helpers.toLuaObject setupOptions})''; + }; + }; +}