mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-10 09:14:31 +02:00
nixvim: support standalone nixvim
This represents a major rearchitecture for nixvim, so I'm leaving this up to track the progress for now, and to serve as a reference for any breaking changes during transition. The main change is, of course, being able to use nixvim standalone. To do this, you should use the new build function, which takes in two arguments: the system architecture (e.g. x86_64-linux) and the configuration. For the new configuration, do not use the programs.nixvim. prefix. For module development, the main change is that you should no longer prefix your modules with programs.nixvim..
This commit is contained in:
parent
bd6f978d51
commit
4ddd3969e5
52 changed files with 1410 additions and 904 deletions
|
@ -1,18 +1,19 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.nixvim.plugins.airline;
|
||||
cfg = config.plugins.airline;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
|
||||
sectionType = with types; nullOr (oneOf [ str (listOf str)]);
|
||||
sectionType = with types; nullOr (oneOf [ str (listOf str) ]);
|
||||
sectionOption = mkOption {
|
||||
default = null;
|
||||
type = sectionType;
|
||||
description = "Configuration for this section. Can be either a statusline-format string or a list of modules to be passed to airline#section#create_*.";
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.nixvim.plugins.airline = {
|
||||
plugins.airline = {
|
||||
enable = mkEnableOption "Enable airline";
|
||||
|
||||
extensions = mkOption {
|
||||
|
@ -49,17 +50,18 @@ in {
|
|||
};
|
||||
|
||||
theme = mkOption {
|
||||
default = config.programs.nixvim.colorscheme;
|
||||
default = config.colorscheme;
|
||||
type = with types; nullOr str;
|
||||
description = "The theme to use for vim-airline. If set, vim-airline-themes will be installed.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
sections = {};
|
||||
in mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
config =
|
||||
let
|
||||
sections = { };
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
vim-airline
|
||||
] ++ optional (!isNull cfg.theme) vim-airline-themes;
|
||||
|
@ -72,5 +74,4 @@ in {
|
|||
airline_theme = mkIf (!isNull cfg.theme) cfg.theme;
|
||||
} // sections;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.nixvim.plugins.lightline;
|
||||
cfg = config.plugins.lightline;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.nixvim.plugins.lightline = {
|
||||
plugins.lightline = {
|
||||
enable = mkEnableOption "Enable lightline";
|
||||
|
||||
colorscheme = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = config.programs.nixvim.colorscheme;
|
||||
default = config.colorscheme;
|
||||
description = "The colorscheme to use for lightline. Defaults to .colorscheme.";
|
||||
example = "gruvbox";
|
||||
};
|
||||
|
@ -24,7 +25,7 @@ in {
|
|||
You should define the functions themselves in extraConfig
|
||||
'';
|
||||
example = ''
|
||||
programs.nixvim.plugins.lightline = {
|
||||
plugins.lightline = {
|
||||
enable = true;
|
||||
componentFunction = {
|
||||
readonly = "LightlineReadonly";
|
||||
|
@ -48,21 +49,23 @@ in {
|
|||
active = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule {
|
||||
options = let
|
||||
listType = with types; nullOr (listOf (listOf str));
|
||||
in {
|
||||
left = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the left side of the bar";
|
||||
default = null;
|
||||
};
|
||||
options =
|
||||
let
|
||||
listType = with types; nullOr (listOf (listOf str));
|
||||
in
|
||||
{
|
||||
left = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the left side of the bar";
|
||||
default = null;
|
||||
};
|
||||
|
||||
right = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the right side of the bar";
|
||||
default = null;
|
||||
right = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the right side of the bar";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -74,14 +77,14 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
configAttrs = filterAttrs (_: v: v != null) {
|
||||
inherit (cfg) colorscheme active component componentFunction modeMap;
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
config =
|
||||
let
|
||||
configAttrs = filterAttrs (_: v: v != null) {
|
||||
inherit (cfg) colorscheme active component componentFunction modeMap;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ pkgs.vimPlugins.lightline-vim ];
|
||||
globals.lightline = mkIf (configAttrs != {}) configAttrs;
|
||||
globals.lightline = mkIf (configAttrs != { }) configAttrs;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.nixvim.plugins.lualine;
|
||||
cfg = config.plugins.lualine;
|
||||
helpers = import ../helpers.nix { lib = lib; };
|
||||
separators = mkOption {
|
||||
type = types.nullOr (types.submodule {
|
||||
|
@ -43,13 +43,14 @@ let
|
|||
});
|
||||
default = null;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.nixvim.plugins.lualine = {
|
||||
plugins.lualine = {
|
||||
enable = mkEnableOption "Enable lualine";
|
||||
|
||||
theme = mkOption {
|
||||
default = config.programs.nixvim.colorscheme;
|
||||
default = config.colorscheme;
|
||||
type = types.nullOr types.str;
|
||||
description = "The theme to use for lualine-nvim.";
|
||||
};
|
||||
|
@ -109,25 +110,25 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
config = let
|
||||
setupOptions = {
|
||||
options = {
|
||||
theme = cfg.theme;
|
||||
section_separators = cfg.sectionSeparators;
|
||||
component_separators = cfg.componentSeparators;
|
||||
disabled_filetypes = cfg.disabledFiletypes;
|
||||
always_divide_middle = cfg.alwaysDivideMiddle;
|
||||
};
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
options = {
|
||||
theme = cfg.theme;
|
||||
section_separators = cfg.sectionSeparators;
|
||||
component_separators = cfg.componentSeparators;
|
||||
disabled_filetypes = cfg.disabledFiletypes;
|
||||
always_divide_middle = cfg.alwaysDivideMiddle;
|
||||
};
|
||||
|
||||
sections = cfg.sections;
|
||||
tabline = cfg.tabline;
|
||||
extensions = cfg.extensions;
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
sections = cfg.sections;
|
||||
tabline = cfg.tabline;
|
||||
extensions = cfg.extensions;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ pkgs.vimPlugins.lualine-nvim ];
|
||||
extraConfigLua =
|
||||
''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue