mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
modules: cleanup with lib
This commit is contained in:
parent
ff042dfc93
commit
1c9ba58aef
12 changed files with 79 additions and 85 deletions
|
@ -4,7 +4,6 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
optionsAttrs = {
|
||||
opts = {
|
||||
|
@ -37,18 +36,18 @@ let
|
|||
};
|
||||
in
|
||||
{
|
||||
options = mapAttrs (
|
||||
options = lib.mapAttrs (
|
||||
_:
|
||||
{ description, ... }:
|
||||
mkOption {
|
||||
type = with types; attrsOf anything;
|
||||
lib.mkOption {
|
||||
type = with lib.types; attrsOf anything;
|
||||
default = { };
|
||||
inherit description;
|
||||
}
|
||||
) optionsAttrs;
|
||||
|
||||
# Added 2024-03-29 (do not remove)
|
||||
imports = mapAttrsToList (old: new: mkRenamedOptionModule [ old ] [ new ]) {
|
||||
imports = lib.mapAttrsToList (old: new: lib.mkRenamedOptionModule [ old ] [ new ]) {
|
||||
options = "opts";
|
||||
globalOptions = "globalOpts";
|
||||
localOptions = "localOpts";
|
||||
|
@ -58,7 +57,7 @@ in
|
|||
extraConfigLuaPre =
|
||||
let
|
||||
content = helpers.concatNonEmptyLines (
|
||||
mapAttrsToList (
|
||||
lib.mapAttrsToList (
|
||||
optionName:
|
||||
{
|
||||
prettyName,
|
||||
|
@ -70,7 +69,7 @@ in
|
|||
varName = "nixvim_${luaVariableName}";
|
||||
optionDefinitions = config.${optionName};
|
||||
in
|
||||
optionalString (optionDefinitions != { }) ''
|
||||
lib.optionalString (optionDefinitions != { }) ''
|
||||
-- Set up ${prettyName} {{{
|
||||
do
|
||||
local ${varName} = ${helpers.toLuaObject optionDefinitions}
|
||||
|
@ -84,6 +83,6 @@ in
|
|||
) optionsAttrs
|
||||
);
|
||||
in
|
||||
mkIf (content != "") (mkOrder 600 content); # Move options to top of file below global table
|
||||
lib.mkIf (content != "") (lib.mkOrder 600 content); # Move options to top of file below global table
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue