statusline/lualine: Move helper to lib

This commit is contained in:
Kalle Jepsen 2023-10-24 09:18:44 +02:00
parent 11a974a111
commit 2a809a64ff
3 changed files with 27 additions and 25 deletions

View file

@ -44,4 +44,6 @@
) )
) )
+ " }"; + " }";
# Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first
luaTable = items: ''{${builtins.concatStringsSep "," items}}'';
} }

View file

@ -5,7 +5,7 @@
}: }:
with lib; let with lib; let
cfg = config.vim.statusline.lualine; cfg = config.vim.statusline.lualine;
luaTable = items: ''{${builtins.concatStringsSep "," items}}''; inherit (nvim.lua) luaTable;
in { in {
config = (mkIf cfg.enable) { config = (mkIf cfg.enable) {
vim.startPlugins = [ vim.startPlugins = [

View file

@ -117,7 +117,7 @@ in {
activeSection = { activeSection = {
a = mkOption { a = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "active config for: | (A) | B | C X | Y | Z |"; description = "active config for: | (A) | B | C X | Y | Z |";
default = [ default = [
'' ''
@ -134,7 +134,7 @@ in {
}; };
b = mkOption { b = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "active config for: | A | (B) | C X | Y | Z |"; description = "active config for: | A | (B) | C X | Y | Z |";
default = [ default = [
'' ''
@ -157,7 +157,7 @@ in {
}; };
c = mkOption { c = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "active config for: | A | B | (C) X | Y | Z |"; description = "active config for: | A | B | (C) X | Y | Z |";
default = [ default = [
'' ''
@ -181,7 +181,7 @@ in {
}; };
x = mkOption { x = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "active config for: | A | B | C (X) | Y | Z |"; description = "active config for: | A | B | C (X) | Y | Z |";
default = [ default = [
'' ''
@ -239,7 +239,7 @@ in {
}; };
y = mkOption { y = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "active config for: | A | B | C X | (Y) | Z |"; description = "active config for: | A | B | C X | (Y) | Z |";
default = [ default = [
'' ''
@ -261,7 +261,7 @@ in {
}; };
z = mkOption { z = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "active config for: | A | B | C X | Y | (Z) |"; description = "active config for: | A | B | C X | Y | (Z) |";
default = [ default = [
'' ''
@ -293,32 +293,32 @@ in {
}; };
extraActiveSection = { extraActiveSection = {
a = mkOption { a = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for activeSection.a"; description = "Extra entries for activeSection.a";
default = []; default = [];
}; };
b = mkOption { b = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for activeSection.b"; description = "Extra entries for activeSection.b";
default = []; default = [];
}; };
c = mkOption { c = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for activeSection.c"; description = "Extra entries for activeSection.c";
default = []; default = [];
}; };
x = mkOption { x = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for activeSection.x"; description = "Extra entries for activeSection.x";
default = []; default = [];
}; };
y = mkOption { y = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for activeSection.y"; description = "Extra entries for activeSection.y";
default = []; default = [];
}; };
z = mkOption { z = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for activeSection.z"; description = "Extra entries for activeSection.z";
default = []; default = [];
}; };
@ -326,69 +326,69 @@ in {
inactiveSection = { inactiveSection = {
a = mkOption { a = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "inactive config for: | (A) | B | C X | Y | Z |"; description = "inactive config for: | (A) | B | C X | Y | Z |";
default = []; default = [];
}; };
b = mkOption { b = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "inactive config for: | A | (B) | C X | Y | Z |"; description = "inactive config for: | A | (B) | C X | Y | Z |";
default = []; default = [];
}; };
c = mkOption { c = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "inactive config for: | A | B | (C) X | Y | Z |"; description = "inactive config for: | A | B | (C) X | Y | Z |";
default = ["'filename'"]; default = ["'filename'"];
}; };
x = mkOption { x = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "inactive config for: | A | B | C (X) | Y | Z |"; description = "inactive config for: | A | B | C (X) | Y | Z |";
default = ["'location'"]; default = ["'location'"];
}; };
y = mkOption { y = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "inactive config for: | A | B | C X | (Y) | Z |"; description = "inactive config for: | A | B | C X | (Y) | Z |";
default = []; default = [];
}; };
z = mkOption { z = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "inactive config for: | A | B | C X | Y | (Z) |"; description = "inactive config for: | A | B | C X | Y | (Z) |";
default = []; default = [];
}; };
}; };
extraInactiveSection = { extraInactiveSection = {
a = mkOption { a = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for inactiveSection.a"; description = "Extra entries for inactiveSection.a";
default = []; default = [];
}; };
b = mkOption { b = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for inactiveSection.b"; description = "Extra entries for inactiveSection.b";
default = []; default = [];
}; };
c = mkOption { c = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for inactiveSection.c"; description = "Extra entries for inactiveSection.c";
default = []; default = [];
}; };
x = mkOption { x = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for inactiveSection.x"; description = "Extra entries for inactiveSection.x";
default = []; default = [];
}; };
y = mkOption { y = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for inactiveSection.y"; description = "Extra entries for inactiveSection.y";
default = []; default = [];
}; };
z = mkOption { z = mkOption {
type = types.listOf types.str; type = with types; listOf str;
description = "Extra entries for inactiveSection.z"; description = "Extra entries for inactiveSection.z";
default = []; default = [];
}; };