Merge pull request #178 from NotAShelf/assert-assertions

This commit is contained in:
raf 2023-11-16 12:03:58 +03:00 committed by GitHub
commit a535f87cc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
144 changed files with 682 additions and 626 deletions

View file

@ -805,11 +805,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1689759503,
"narHash": "sha256-wFrcae6V58hIlDW+7NDoUXzXBmsU7W/k3V1KIePcwRA=",
"lastModified": 1699423608,
"narHash": "sha256-WEVUgivm5DCziwZqiXRPeoD3FQTXW38ExKrZjvMveqE=",
"owner": "oxalica",
"repo": "nil",
"rev": "59bcad0b13b5d77668c0c125fef71d7b41406d7a",
"rev": "5607d429016d6f9a72843b07127fad23ea9d661f",
"type": "github"
},
"original": {
@ -1583,11 +1583,11 @@
]
},
"locked": {
"lastModified": 1688783586,
"narHash": "sha256-HHaM2hk2azslv1kH8zmQxXo2e7i5cKgzNIuK4yftzB0=",
"lastModified": 1696817516,
"narHash": "sha256-Xt9OY4Wnk9/vuUfA0OHFtmSlaen5GyiS9msgwOz3okI=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "7a29283cc242c2486fc67f60b431ef708046d176",
"rev": "c0df7f2a856b5ff27a3ce314f6d7aacf5fda546f",
"type": "github"
},
"original": {

View file

@ -38,12 +38,19 @@
};
perSystem = {
self',
config,
pkgs,
...
}: {
devShells.default = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];};
formatter = pkgs.alejandra;
devShells = {
default = self'.devShells.lsp;
nvim-nix = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];};
lsp = pkgs.mkShell {
nativeBuildInputs = with pkgs; [nil statix deadnix];
};
};
};
};

View file

@ -4,4 +4,5 @@
types = import ./types {inherit lib;};
languages = import ./languages.nix {inherit lib;};
lua = import ./lua.nix {inherit lib;};
vim = import ./vim.nix {inherit lib;};
}

View file

@ -1,11 +1,8 @@
# Helpers for converting values to lua
{lib}: rec {
# yes? no.
yesNo = value:
if value
then "yes"
else "no";
{lib}: let
inherit (lib) mapAttrsToList filterAttrs concatStringsSep concatMapStringsSep stringToCharacters boolToString;
inherit (builtins) hasAttr head;
in rec {
# Convert a null value to lua's nil
nullString = value:
if value == null
@ -46,4 +43,44 @@
+ " }";
# 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}}'';
toLuaObject = args:
if builtins.isAttrs args
then
if hasAttr "__raw" args
then args.__raw
else if hasAttr "__empty" args
then "{ }"
else
"{"
+ (concatStringsSep ","
(mapAttrsToList
(n: v:
if head (stringToCharacters n) == "@"
then toLuaObject v
else "[${toLuaObject n}] = " + (toLuaObject v))
(filterAttrs
(
_: v:
(v != null) && (toLuaObject v != "{}")
)
args)))
+ "}"
else if builtins.isList args
then "{" + concatMapStringsSep "," toLuaObject args + "}"
else if builtins.isString args
then
# This should be enough!
builtins.toJSON args
else if builtins.isPath args
then builtins.toJSON (toString args)
else if builtins.isBool args
then "${boolToString args}"
else if builtins.isFloat args
then "${toString args}"
else if builtins.isInt args
then "${toString args}"
else if (args != null)
then "nil"
else "";
}

26
lib/vim.nix Normal file
View file

@ -0,0 +1,26 @@
{lib}: let
inherit (builtins) isInt isBool toJSON;
in rec {
# yes? no.
yesNo = value:
if value
then "yes"
else "no";
# convert a boolean to a vim compliant boolean string
mkVimBool = val:
if val
then "1"
else "0";
# convert a literal value to a vim compliant value
valToVim = val:
if (isInt val)
then (builtins.toString val)
else
(
if (isBool val)
then (mkVimBool val)
else (toJSON val)
);
}

View file

@ -1,27 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.vim;
in {
config = {
assertions = mkMerge [
{
assertion = cfg.kommentary.enable;
message = "Kommentary has been deprecated in favor of comments-nvim";
}
{
assertion = cfg.utility.colorizer.enable;
message = "config.utility.colorizer has been renamed to config.utility.ccc";
}
mkIf
(config.programs.neovim-flake.enable)
{
assertion = !config.programs.neovim.enable;
message = "You cannot use `programs.neovim-flake.enable` with `programs.neovim.enable`";
}
];
};
}

View file

@ -3,9 +3,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) toJSON;
inherit (lib) mkIf nvim mkLuaBinding mkMerge;
cfg = config.vim.assistant.copilot;
wrapPanelBinding = luaFunction: key: ''
@ -13,7 +14,7 @@ with builtins; let
local s, _ = pcall(${luaFunction})
if not s then
local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON key}, true, false, true)
local termcode = vim.api.nvim_replace_termcodes(${toJSON key}, true, false, true)
vim.fn.feedkeys(termcode, 'n')
end

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkEnableOption mkOption types;
cfg = config.vim.assistant.copilot;
in {
options.vim.assistant.copilot = {

View file

@ -2,9 +2,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) toJSON;
inherit (lib) mkIf mkMerge mkExprBinding boolToString nvim;
cfg = config.vim.assistant.tabnine;
in {
config = mkIf cfg.enable {
@ -17,7 +18,7 @@ in {
local completion = require("tabnine.completion")
if not state.completions_cache then
return "${builtins.toJSON cfg.mappings.accept}"
return "${toJSON cfg.mappings.accept}"
end
vim.schedule(completion.accept)
@ -29,7 +30,7 @@ in {
local completion = require("tabnine.completion")
if not state.completions_cache then
return "${builtins.toJSON cfg.mappings.dismiss}"
return "${toJSON cfg.mappings.dismiss}"
end
vim.schedule(function()

View file

@ -1,6 +1,6 @@
{lib, ...}:
with lib;
with builtins; {
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types mkMappingOption;
in {
options.vim.assistant.tabnine = {
enable = mkEnableOption "Tabnine assistant";

View file

@ -2,9 +2,9 @@
lib,
config,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim optionalString boolToString;
cfg = config.vim.autopairs;
in {
config =

View file

@ -1,6 +1,6 @@
{lib, ...}:
with lib;
with builtins; {
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types;
in {
options.vim = {
autopairs = {
enable = mkEnableOption "autopairs" // {default = false;};

View file

@ -2,9 +2,10 @@
lib,
config,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) concatStringsSep;
inherit (lib) optionalString mkIf nvim;
cfg = config.vim;
in {
config = {
@ -57,8 +58,8 @@ in {
};
vim.configRC.basic = nvim.dag.entryAfter ["globalsScript"] ''
" Debug mode settings
${optionalString cfg.debugMode.enable ''
" Debug mode settings
set verbose=${toString cfg.debugMode.level}
set verbosefile=${cfg.debugMode.logFile}
''}
@ -141,7 +142,7 @@ in {
''}
${optionalString cfg.spellChecking.enable ''
set spell
set spelllang=${builtins.concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"}
set spelllang=${concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"}
''}
${optionalString (cfg.leaderKey != null) ''
let mapleader = "${toString cfg.leaderKey}"

View file

@ -2,9 +2,10 @@
pkgs,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption mkOption;
inherit (lib.types) types;
in {
options.vim = {
package = mkOption {
type = types.package;

View file

@ -1,6 +1,6 @@
{lib, ...}:
with lib;
with builtins; {
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption;
in {
options.vim.comments.comment-nvim = {
enable = mkEnableOption "smart and powerful comment plugin for neovim comment-nvim";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf mkMerge mkExprBinding mkBinding nvim;
cfg = config.vim.comments.comment-nvim;
self = import ./comment-nvim.nix {
inherit lib;

View file

@ -2,9 +2,11 @@
lib,
config,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) toJSON;
inherit (lib) addDescriptionsToMappings concatMapStringsSep attrNames concatStringsSep mapAttrsToList mkIf mkSetLuaBinding mkMerge optionalString;
inherit (lib.nvim) dag;
cfg = config.vim.autocomplete;
lspkindEnabled = config.vim.lsp.enable && config.vim.lsp.lspkind.enable;
@ -31,8 +33,8 @@ with builtins; let
dagPlacement =
if lspkindEnabled
then nvim.dag.entryAfter ["lspkind"]
else nvim.dag.entryAnywhere;
then dag.entryAfter ["lspkind"]
else dag.entryAnywhere;
in {
config = mkIf cfg.enable {
vim.startPlugins = [
@ -59,7 +61,7 @@ in {
(mkSetLuaBinding mappings.confirm ''
function()
if not require('cmp').confirm({ select = true }) then
local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON mappings.confirm.value}, true, false, true)
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.confirm.value}, true, false, true)
vim.fn.feedkeys(termcode, 'n')
end
@ -85,7 +87,7 @@ in {
elseif has_words_before() then
cmp.complete()
else
local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON mappings.next.value}, true, false, true)
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.next.value}, true, false, true)
vim.fn.feedkeys(termcode, 'n')
end
@ -152,7 +154,7 @@ in {
elseif has_words_before() then
cmp.complete()
else
local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON mappings.next.value}, true, false, true)
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.next.value}, true, false, true)
vim.fn.feedkeys(termcode, 'n')
end

View file

@ -1,6 +1,6 @@
{lib, ...}:
with lib;
with builtins; {
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption mkOption types;
in {
options.vim = {
autocomplete = {
enable = mkEnableOption "enable autocomplete" // {default = false;};

View file

@ -2,9 +2,13 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrValues attrNames map mapAttrs toJSON isString concatStringsSep filter;
inherit (lib) mkOption types mapAttrsFlatten filterAttrs optionalString getAttrs literalExpression;
inherit (lib) nvim;
inherit (nvim.lua) toLuaObject;
inherit (nvim.vim) valToVim;
cfg = config.vim;
wrapLuaConfig = luaConfig: ''
@ -20,7 +24,7 @@ with builtins; let
mkOption {
type = types.bool;
default = value;
description = description;
inherit description;
};
# Most of the keybindings code is highly inspired by pta2002/nixvim. Thank you!
@ -67,7 +71,7 @@ with builtins; let
normalizeAction = action: let
# Extract the values of the config options that have been explicitly set by the user
config =
filterAttrs (n: v: v != null)
filterAttrs (_: v: v != null)
(getAttrs (attrNames mapConfigOptions) action);
in {
config =
@ -80,13 +84,13 @@ with builtins; let
else action.action;
};
in
builtins.attrValues (builtins.mapAttrs
attrValues (mapAttrs
(key: action: let
normalizedAction = normalizeAction action;
in {
inherit (normalizedAction) action config;
key = key;
mode = mode;
inherit key;
inherit mode;
})
maps);
@ -117,171 +121,144 @@ with builtins; let
default = {};
};
in {
options.vim = {
viAlias = mkOption {
description = "Enable vi alias";
type = types.bool;
default = true;
};
vimAlias = mkOption {
description = "Enable vim alias";
type = types.bool;
default = true;
};
configRC = mkOption {
description = "vimrc contents";
type = types.oneOf [(nvim.types.dagOf types.lines) types.str];
default = {};
};
luaConfigRC = mkOption {
description = "vim lua config";
type = types.oneOf [(nvim.types.dagOf types.lines) types.str];
default = {};
};
builtConfigRC = mkOption {
options = {
assertions = lib.mkOption {
type = with types; listOf unspecified;
internal = true;
type = types.lines;
description = "The built config for neovim after resolving the DAG";
};
startPlugins = nvim.types.pluginsOpt {
default = [];
description = "List of plugins to startup.";
};
optPlugins = nvim.types.pluginsOpt {
default = [];
description = "List of plugins to optionally load";
};
extraPlugins = mkOption {
type = types.attrsOf nvim.types.extraPluginType;
default = {};
description = ''
List of plugins and related config.
Note that these are setup after builtin plugins.
'';
example = literalExpression ''
with pkgs.vimPlugins; {
aerial = {
package = aerial-nvim;
setup = "require('aerial').setup {}";
};
harpoon = {
package = harpoon;
setup = "require('harpoon').setup {}";
after = ["aerial"];
};
}'';
[
{
assertion = false;
message = "you can't enable this for that reason";
}
]
'';
};
globals = mkOption {
default = {};
description = "Set containing global variable values";
type = types.attrs;
warnings = mkOption {
internal = true;
default = [];
type = with types; listOf str;
example = ["The `foo' service is deprecated and will go away soon!"];
description = lib.mdDoc ''
This option allows modules to show warnings to users during
the evaluation of the system configuration.
'';
};
maps = mkOption {
type = types.submodule {
options = {
normal = mapOptions "normal";
insert = mapOptions "insert";
select = mapOptions "select";
visual = mapOptions "visual and select";
terminal = mapOptions "terminal";
normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')";
visualOnly = mapOptions "visual only";
operator = mapOptions "operator-pending";
insertCommand = mapOptions "insert and command-line";
lang = mapOptions "insert, command-line and lang-arg";
command = mapOptions "command-line";
};
vim = {
viAlias = mkOption {
description = "Enable vi alias";
type = types.bool;
default = true;
};
default = {};
description = ''
Custom keybindings for any mode.
For plain maps (e.g. just 'map' or 'remap') use maps.normalVisualOp.
'';
vimAlias = mkOption {
description = "Enable vim alias";
type = types.bool;
default = true;
};
example = ''
maps = {
normal."<leader>m" = {
silent = true;
action = "<cmd>make<CR>";
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
configRC = mkOption {
description = "vimrc contents";
type = types.oneOf [(nvim.types.dagOf types.lines) types.str];
default = {};
};
luaConfigRC = mkOption {
description = "vim lua config";
type = types.oneOf [(nvim.types.dagOf types.lines) types.str];
default = {};
};
builtConfigRC = mkOption {
internal = true;
type = types.lines;
description = "The built config for neovim after resolving the DAG";
};
startPlugins = nvim.types.pluginsOpt {
default = [];
description = "List of plugins to startup.";
};
optPlugins = nvim.types.pluginsOpt {
default = [];
description = "List of plugins to optionally load";
};
extraPlugins = mkOption {
type = types.attrsOf nvim.types.extraPluginType;
default = {};
description = ''
List of plugins and related config.
Note that these are setup after builtin plugins.
'';
example = literalExpression ''
with pkgs.vimPlugins; {
aerial = {
package = aerial-nvim;
setup = "require('aerial').setup {}";
};
harpoon = {
package = harpoon;
setup = "require('harpoon').setup {}";
after = ["aerial"];
};
}'';
};
globals = mkOption {
default = {};
description = "Set containing global variable values";
type = types.attrs;
};
maps = mkOption {
type = types.submodule {
options = {
normal = mapOptions "normal";
insert = mapOptions "insert";
select = mapOptions "select";
visual = mapOptions "visual and select";
terminal = mapOptions "terminal";
normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')";
visualOnly = mapOptions "visual only";
operator = mapOptions "operator-pending";
insertCommand = mapOptions "insert and command-line";
lang = mapOptions "insert, command-line and lang-arg";
command = mapOptions "command-line";
};
};
'';
default = {};
description = ''
Custom keybindings for any mode.
For plain maps (e.g. just 'map' or 'remap') use maps.normalVisualOp.
'';
example = ''
maps = {
normal."<leader>m" = {
silent = true;
action = "<cmd>make<CR>";
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
};
'';
};
};
};
config = let
mkVimBool = val:
if val
then "1"
else "0";
valToVim = val:
if (isInt val)
then (builtins.toString val)
else
(
if (isBool val)
then (mkVimBool val)
else (toJSON val)
);
filterNonNull = mappings: filterAttrs (_name: value: value != null) mappings;
globalsScript =
mapAttrsFlatten (name: value: "let g:${name}=${valToVim value}")
(filterNonNull cfg.globals);
toLuaObject = args:
if builtins.isAttrs args
then
if hasAttr "__raw" args
then args.__raw
else if hasAttr "__empty" args
then "{ }"
else
"{"
+ (concatStringsSep ","
(mapAttrsToList
(n: v:
if head (stringToCharacters n) == "@"
then toLuaObject v
else "[${toLuaObject n}] = " + (toLuaObject v))
(filterAttrs
(
n: v:
!isNull v && (toLuaObject v != "{}")
)
args)))
+ "}"
else if builtins.isList args
then "{" + concatMapStringsSep "," toLuaObject args + "}"
else if builtins.isString args
then
# This should be enough!
builtins.toJSON args
else if builtins.isPath args
then builtins.toJSON (toString args)
else if builtins.isBool args
then "${boolToString args}"
else if builtins.isFloat args
then "${toString args}"
else if builtins.isInt args
then "${toString args}"
else if isNull args
then "nil"
else "";
toLuaBindings = mode: maps:
builtins.map (value: ''
map (value: ''
vim.keymap.set(${toLuaObject mode}, ${toLuaObject value.key}, ${toLuaObject value.action}, ${toLuaObject value.config})
'') (genMaps mode maps);
@ -304,8 +281,8 @@ in {
mapResult,
}: let
# When the value is a string, default it to dag.entryAnywhere
finalDag = lib.mapAttrs (name: value:
if builtins.isString value
finalDag = lib.mapAttrs (_: value:
if isString value
then nvim.dag.entryAnywhere value
else value)
dag;
@ -313,7 +290,7 @@ in {
result =
if sortedDag ? result
then mapResult sortedDag.result
else abort ("Dependency cycle in ${name}: " + toJSON sortedConfig);
else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);
in
result;
in {
@ -378,6 +355,13 @@ in {
};
builtConfigRC = let
failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
baseSystemAssertWarn =
if failedAssertions != []
then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
else lib.showWarnings config.warnings;
mkSection = r: ''
" SECTION: ${r.name}
${r.data}
@ -389,7 +373,7 @@ in {
inherit mapResult;
};
in
vimConfig;
baseSystemAssertWarn vimConfig;
};
};
}

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption;
in {
options.vim.dashboard.alpha = {
enable = mkEnableOption "dashboard via alpha.nvim";
};

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim;
cfg = config.vim.dashboard.alpha;
in {
config = mkIf cfg.enable {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim;
cfg = config.vim.dashboard.dashboard-nvim;
in {
config = mkIf cfg.enable {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption;
in {
options.vim.dashboard.dashboard-nvim = {
enable = mkEnableOption "dashboard via dashboard.nvim";
};

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with builtins;
with lib; let
}: let
inherit (lib) mkIf;
cfg = config.vim.dashboard.startify;
mkVimBool = val:

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with builtins;
with lib; {
}: let
inherit (lib) mkEnableOption mkOption types;
in {
options.vim.dashboard.startify = {
enable = mkEnableOption "dashboard via vim-startify";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) addDescriptionsToMappings mkMerge mkIf mapAttrs nvim mkSetLuaBinding optionalString;
cfg = config.vim.debugger.nvim-dap;
self = import ./nvim-dap.nix {
inherit lib;

View file

@ -1,5 +1,6 @@
{lib, ...}:
with lib; {
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types mkMappingOption;
in {
options.vim.debugger.nvim-dap = {
enable = mkEnableOption "debugging via nvim-dap";

View file

@ -5,8 +5,8 @@ inputs: {
check ? true,
extraSpecialArgs ? {},
}: let
inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins;
inherit (builtins) map filter isString toString getAttr;
inherit (pkgs) wrapNeovim vimPlugins;
inherit (pkgs.vimUtils) buildVimPlugin;
extendedLib = import ../lib/stdlib-extended.nix lib;
@ -21,6 +21,8 @@ inputs: {
specialArgs = {modulesPath = toString ./.;} // extraSpecialArgs;
};
vimOptions = module.config.vim;
buildPlug = {pname, ...} @ args:
assert lib.asserts.assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
buildVimPlugin (args
@ -31,8 +33,6 @@ inputs: {
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
vimOptions = module.config.vim;
buildConfigPlugins = plugins:
map
(plug: (

View file

@ -3,9 +3,9 @@
lib,
pkgs,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf mkMerge mkBinding nvim boolToString;
cfg = config.vim.filetree.nvimTree;
self = import ./nvimtree.nix {
inherit pkgs;

View file

@ -2,9 +2,9 @@
pkgs,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption mkOption types literalExpression;
in {
options.vim.filetree.nvimTree = {
enable = mkEnableOption "filetree via nvim-tree.lua";

View file

@ -2,9 +2,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) toJSON;
inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetExprBinding mkSetLuaBinding nvim;
cfg = config.vim.git;
self = import ./git.nix {inherit lib;};
@ -70,7 +71,7 @@ in {
vim.lsp.null-ls.sources.gitsigns-ca = ''
table.insert(
ls_sources,
null_ls.builtins.code_actions.gitsigns
null_ls.gcode_actions.gitsigns
)
'';
})

View file

@ -1,6 +1,6 @@
{lib, ...}:
with lib;
with builtins; {
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption;
in {
options.vim.git = {
enable = mkEnableOption "git tools via gitsigns";

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with builtins; let
inherit (lib) mkOption mkEnableOption types;
}: let
inherit (builtins) attrNames;
inherit (lib) mkOption mkEnableOption types isList nvim;
cfg = config.vim.languages.bash;

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) isList nvim mkIf mkMerge;
cfg = config.vim.languages.bash;
diagnostics = {
shellcheck = {

View file

@ -3,9 +3,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrNames;
inherit (lib) isList nvim optionalString mkEnableOption mkOption types mkIf mkMerge;
cfg = config.vim.languages.clang;
defaultServer = "ccls";

View file

@ -3,9 +3,9 @@
lib,
pkgs,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) isList nvim mkIf mkMerge optionalString boolToString;
cfg = config.vim.languages.dart;
ftcfg = cfg.flutter-tools;
servers = {

View file

@ -3,9 +3,10 @@
lib,
pkgs,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrNames;
inherit (lib) isList nvim mkEnableOption mkOption types optionalString;
cfg = config.vim.languages.dart;
defaultServer = "dart";
servers = {

View file

@ -3,9 +3,9 @@
lib,
pkgs,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) nvim mkIf getExe;
cfg = config.vim.languages.elixir;
in {
config = mkIf (cfg.enable) {
@ -23,7 +23,7 @@ in {
-- alternatively, point to an existing elixir-ls installation (optional)
-- not currently supported by elixirls, but can be a table if you wish to pass other args `{"path/to/elixirls", "--foo"}`
cmd = "${lib.getExe pkgs.elixir-ls}",
cmd = "${getExe pkgs.elixir-ls}",
-- default settings, use the `settings` function to override settings
settings = elixirls.settings {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption;
in {
options.vim.languages.elixir = {
enable = mkEnableOption "Elixir language support";
};

View file

@ -3,9 +3,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrNames;
inherit (lib) isList nvim getExe mkEnableOption mkOption types mkMerge mkIf;
cfg = config.vim.languages.go;
defaultServer = "gopls";

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkEnableOption mkOption types nvim mkIf mkMerge optional;
cfg = config.vim.languages.html;
in {
options.vim.languages.html = {

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
cfg = config.vim.languages.java;
in {
options.vim.languages.java = {

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString getExe;
cfg = config.vim.languages.lua;
in {
options.vim.languages.lua = {

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) nvim mkIf mkMerge;
cfg = config.vim.languages.markdown;
in {
config = mkIf cfg.enable (mkMerge [

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkEnableOption mkOption types nvim;
cfg = config.vim.languages.markdown;
in {
options.vim.languages.markdown = {

View file

@ -3,9 +3,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrNames;
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString;
cfg = config.vim.languages.nix;
useFormat = "on_attach = default_on_attach";

View file

@ -3,9 +3,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrNames;
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe;
cfg = config.vim.languages.php;
defaultServer = "phpactor";

View file

@ -3,9 +3,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrNames;
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe literalExpression;
cfg = config.vim.languages.python;
defaultServer = "pyright";

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString boolToString optionals;
cfg = config.vim.languages.rust;
in {
options.vim.languages.rust = {

View file

@ -3,9 +3,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrNames;
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
cfg = config.vim.languages.sql;
sqlfluffDefault = pkgs.sqlfluff;

View file

@ -3,9 +3,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrNames;
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
cfg = config.vim.languages.svelte;
defaultServer = "svelte";

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf;
cfg = config.vim.tidal;
in {
config = mkIf (cfg.enable) {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption mkOption types;
in {
options.vim.tidal = {
enable = mkEnableOption "tidalcycles tools and plugins";

View file

@ -3,9 +3,10 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (builtins) attrNames;
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
cfg = config.vim.languages.ts;
defaultServer = "tsserver";

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
cfg = config.vim.languages.zig;
in {
options.vim.languages.zig = {

View file

@ -3,9 +3,9 @@
lib,
pkgs,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) addDescriptionsToMappings mkIf optional boolToString optionalString;
cfg = config.vim.lsp;
usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp";
self = import ./module.nix {inherit config lib pkgs;};

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim;
cfg = config.vim.lsp;
in {
config = mkIf (cfg.enable && cfg.lightbulb.enable) {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption;
in {
options.vim.lsp = {
lightbulb = {
enable = mkEnableOption "Lightbulb for code actions. Requires an emoji font";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim optionalString;
cfg = config.vim.lsp;
in {
config = mkIf (cfg.enable && cfg.lspSignature.enable) {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption;
in {
options.vim.lsp = {
lspSignature = {
enable = mkEnableOption "lsp signature viewer";

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf mkMerge nvim optionalString mapAttrs;
cfg = config.vim.lsp;
in {
config = mkIf cfg.lspconfig.enable (mkMerge [

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption mkOption types;
in {
options.vim.lsp.lspconfig = {
enable = mkEnableOption "nvim-lspconfig, also enabled automatically";

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim;
cfg = config.vim.lsp;
in {
config = mkIf (cfg.enable && cfg.lspkind.enable) {

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkEnableOption mkOption types;
cfg = config.vim.lsp;
in {
options.vim.lsp = {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim;
cfg = config.vim.lsp;
in {
config = mkIf (cfg.enable && cfg.lsplines.enable) {

View file

@ -1,6 +1,6 @@
{lib, ...}:
with lib;
with builtins; {
{lib, ...}: let
inherit (lib) mkEnableOption;
in {
options.vim.lsp = {
lsplines = {
enable = mkEnableOption "diagnostics using virtual lines on top of the real line of code. [lsp_lines]";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) addDescriptionsToMappings mkIf mkSetLuaBinding mkMerge nvim optionalString;
cfg = config.vim.lsp;
self = import ./lspsaga.nix {inherit lib;};

View file

@ -1,6 +1,6 @@
{lib, ...}:
with lib;
with builtins; {
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption;
in {
options.vim.lsp.lspsaga = {
enable = mkEnableOption "LSP Saga";

View file

@ -1,6 +1,5 @@
{lib, ...}:
with lib;
with builtins; let
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption;
in {
options.vim.lsp = {
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf mkMerge nvim mapAttrs;
cfg = config.vim.lsp;
in {
config = mkIf cfg.null-ls.enable (mkMerge [

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkEnableOption mkOption types;
cfg = config.vim.lsp;
in {
options.vim.lsp.null-ls = {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) addDescriptionsToMappings mkIf mkSetBinding nvim;
cfg = config.vim.lsp;
self = import ./nvim-code-action-menu.nix {inherit lib;};

View file

@ -1,5 +1,6 @@
{lib, ...}:
with lib; {
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption;
in {
options.vim.lsp = {
nvimCodeActionMenu = {
enable = mkEnableOption "nvim code action menu";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim;
cfg = config.vim.lsp;
self = import ./trouble.nix {inherit lib;};

View file

@ -1,5 +1,6 @@
{lib, ...}:
with lib; {
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption;
in {
options.vim.lsp = {
trouble = {
enable = mkEnableOption "trouble diagnostics viewer";

View file

@ -1,5 +1,6 @@
{lib, ...}:
with lib; {
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption;
in {
options.vim.minimap.codewindow = {
enable = mkEnableOption "codewindow plugin for minimap view";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetLuaBinding nvim;
cfg = config.vim.minimap.codewindow;
self = import ./codewindow.nix {inherit lib;};

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf;
cfg = config.vim.minimap.minimap-vim;
in {
config = mkIf cfg.enable {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption;
in {
options.vim.minimap.minimap-vim = {
enable = mkEnableOption "minimap-vim plugin for minimap view";
};

View file

@ -34,10 +34,14 @@
pkgsModule = {config, ...}: {
config = {
_module.args.baseModules = modules;
_module.args.pkgsPath = lib.mkDefault pkgs.path;
_module.args.pkgs = lib.mkDefault pkgs;
_module.check = check;
_module = {
inherit check;
args = {
baseModules = modules;
pkgsPath = lib.mkDefault pkgs.path;
pkgs = lib.mkDefault pkgs;
};
};
};
};
in

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim;
cfg = config.vim.notes.mind-nvim;
in {
config = mkIf (cfg.enable) {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption;
in {
options.vim.notes.mind-nvim = {
enable = mkEnableOption "organizer tool for Neovim.";
};

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim;
cfg = config.vim.notes.obsidian;
auto = config.vim.autocomplete;
in {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption mkOption types;
in {
options.vim.notes = {
obsidian = {
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf mkMerge nvim;
cfg = config.vim.notes.orgmode;
in {
config = mkIf cfg.enable (mkMerge [

View file

@ -3,9 +3,9 @@
lib,
pkgs,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption types mkOption nvim;
in {
options.vim.notes.orgmode = {
enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds";

View file

@ -3,9 +3,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkMerge mkBinding mkIf;
cfg = config.vim.notes.todo-comments;
self = import ./todo-comments.nix {inherit lib;};
mappings = self.options.vim.notes.todo-comments.mappings;

View file

@ -1,6 +1,6 @@
{lib, ...}:
with lib;
with builtins; {
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types mkMappingOption;
in {
options.vim.notes.todo-comments = {
enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim boolToString concatStringsSep;
cfg = config.vim.projects.project-nvim;
in {
config = mkIf cfg.enable {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption mkOption types;
in {
options.vim.projects.project-nvim = {
enable = mkEnableOption "project-nvim for project management";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf nvim boolToString;
cfg = config.vim.presence.presence-nvim;
in {
config = mkIf cfg.enable {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption mkOption types;
in {
options.vim.presence.presence-nvim = {
enable = mkEnableOption "presence.nvim plugin for discord rich presence";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf optionals mkMerge mkBinding nvim concatStringsSep boolToString;
cfg = config.vim.session.nvim-session-manager;
in {
config = mkIf cfg.enable {

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; {
}: let
inherit (lib) mkEnableOption mkOption types;
in {
options.vim.session.nvim-session-manager = {
enable = mkEnableOption "nvim-session-manager: manage sessions like folders in VSCode";

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf;
cfg = config.vim.snippets.vsnip;
in {
config = mkIf cfg.enable {

View file

@ -1,5 +1,6 @@
{lib, ...}:
with lib; {
{lib, ...}: let
inherit (lib) mkEnableOption;
in {
options.vim.snippets.vsnip = {
enable = mkEnableOption "vim-vsnip: snippet LSP/VSCode's format";
};

View file

@ -2,10 +2,9 @@
config,
lib,
...
}:
with lib; let
}: let
cfg = config.vim.statusline.lualine;
inherit (nvim.lua) luaTable;
inherit (lib) mkIf nvim boolToString optionalString;
in {
config = (mkIf cfg.enable) {
vim.startPlugins = [
@ -33,21 +32,21 @@ in {
},
-- active sections
sections = {
lualine_a = ${luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)},
lualine_b = ${luaTable (cfg.activeSection.b ++ cfg.extraActiveSection.b)},
lualine_c = ${luaTable (cfg.activeSection.c ++ cfg.extraActiveSection.c)},
lualine_x = ${luaTable (cfg.activeSection.x ++ cfg.extraActiveSection.x)},
lualine_y = ${luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)},
lualine_z = ${luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)},
lualine_a = ${nvim.lua.luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)},
lualine_b = ${nvim.lua.luaTable (cfg.activeSection.b ++ cfg.extraActiveSection.b)},
lualine_c = ${nvim.lua.luaTable (cfg.activeSection.c ++ cfg.extraActiveSection.c)},
lualine_x = ${nvim.lua.luaTable (cfg.activeSection.x ++ cfg.extraActiveSection.x)},
lualine_y = ${nvim.lua.luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)},
lualine_z = ${nvim.lua.luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)},
},
--
inactive_sections = {
lualine_a = ${luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)},
lualine_b = ${luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)},
lualine_c = ${luaTable (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c)},
lualine_x = ${luaTable (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x)},
lualine_y = ${luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)},
lualine_z = ${luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)},
lualine_a = ${nvim.lua.luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)},
lualine_b = ${nvim.lua.luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)},
lualine_c = ${nvim.lua.luaTable (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c)},
lualine_x = ${nvim.lua.luaTable (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x)},
lualine_y = ${nvim.lua.luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)},
lualine_z = ${nvim.lua.luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)},
},
tabline = {},

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkEnableOption mkOption types elem optional;
supported_themes = import ./supported_themes.nix;
colorPuccin =
if config.vim.statusline.lualine.theme == "catppuccin"

View file

@ -2,9 +2,9 @@
config,
lib,
...
}:
with lib;
with builtins; let
}: let
inherit (lib) mkIf mkMerge mkLuaBinding mkBinding nvim;
cfg = config.vim.tabline.nvimBufferline;
self = import ./nvim-bufferline.nix {
inherit lib;

View file

@ -1,6 +1,6 @@
{lib, ...}:
with lib;
with builtins; {
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption;
in {
options.vim.tabline.nvimBufferline = {
enable = mkEnableOption "nvim-bufferline-lua as a bufferline";

Some files were not shown because too many files have changed in this diff Show more