refactor(nvim): add _file and config attrs to all submodules
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-21 23:34:10 -05:00
parent e1d77a4f3b
commit 0f627107ce
23 changed files with 243 additions and 209 deletions

View file

@ -87,7 +87,6 @@
neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};

View file

@ -84,7 +84,6 @@ in {
neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};

View file

@ -70,7 +70,6 @@
neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};

View file

@ -43,7 +43,6 @@
neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};

View file

@ -70,7 +70,6 @@
neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};

View file

@ -84,7 +84,6 @@
neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};

View file

@ -106,7 +106,6 @@
neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};

View file

@ -4,7 +4,9 @@ self: {
pkgs,
...
}: let
inherit (lib) mkOption types;
inherit (lib) mkIf mkOption types;
cfg = config.programs.neovim;
in {
imports = [
./git
@ -17,13 +19,10 @@ in {
user = mkOption {
type = types.str;
};
enableIde = mkOption {
type = types.bool;
default = false;
};
};
config.programs.neovim = {
config = mkIf cfg.enable {
programs.neovim = {
extraLuaConfig =
# lua
''
@ -106,6 +105,7 @@ in {
}
];
};
};
# For accurate stack trace
_file = ./default.nix;

View file

@ -8,7 +8,8 @@
cfg = config.programs.neovim;
in {
programs = mkIf cfg.enable {
config = mkIf cfg.enable {
programs = {
# I love doing typos
bash.shellAliases = {
nivm = "nvim";
@ -20,7 +21,7 @@ in {
viAlias = true;
vimAlias = true;
extraPackages = mkIf cfg.enableIde (attrValues {
extraPackages = attrValues {
inherit
(pkgs.nodePackages)
bash-language-server
@ -30,10 +31,9 @@ in {
(pkgs)
shellcheck
;
});
};
extraLuaConfig =
mkIf cfg.enableIde
# lua
''
vim.api.nvim_create_autocmd('FileType', {
@ -55,4 +55,8 @@ in {
'';
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -9,7 +9,7 @@
cfg = config.programs.neovim;
in {
config = mkIf cfg.enableIde {
config = mkIf cfg.enable {
xdg.configFile."clangd/config.yaml".source = writeYAML "config.yaml" {
CompileFlags.Add = ["-D__cpp_concepts=202002L"];
};
@ -21,6 +21,7 @@ in {
''
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'cpp', 'c' },
-- FIXME: load direnv here https://github.com/actionshrimp/direnv.nvim?tab=readme-ov-file#using-nvim-lspconfig
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
});
'';
@ -57,4 +58,7 @@ in {
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -10,7 +10,7 @@ self: {
cfg = config.programs.neovim;
in {
config = mkIf cfg.enableIde {
config = mkIf cfg.enable {
programs = {
neovim = {
extraPackages = attrValues {
@ -73,5 +73,5 @@ in {
};
# For accurate stack trace
_file = ./csharp.nix;
_file = ./default.nix;
}

View file

@ -1,9 +1,12 @@
self: {
config,
lib,
pkgs,
...
}: let
inherit (lib) fileContents mkBefore;
inherit (lib) fileContents mkBefore mkIf;
cfg = config.programs.neovim;
in {
imports = [
./bash
@ -21,8 +24,8 @@ in {
(import ./web self)
];
config.programs = {
neovim = {
config = mkIf cfg.enable {
programs.neovim = {
extraLuaConfig =
mkBefore
# lua

View file

@ -6,8 +6,8 @@
inherit (lib) mkIf;
cfg = config.programs.neovim;
in
mkIf cfg.enableIde {
in {
config = mkIf cfg.enable {
programs = {
neovim = {
extraLuaConfig =
@ -24,4 +24,8 @@ in
'';
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -10,8 +10,8 @@
javaSdk = pkgs.temurin-bin-17;
javaPkgs = attrValues {inherit (pkgs) gradle maven;};
in
mkIf cfg.enableIde {
in {
config = mkIf cfg.enable {
home.packages = javaPkgs;
xdg.dataFile.".gradle/gradle.properties".text = ''
@ -81,4 +81,8 @@ in
];
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -7,8 +7,8 @@
inherit (lib) attrValues mkIf;
cfg = config.programs.neovim;
in
mkIf cfg.enableIde {
in {
config = mkIf cfg.enable {
programs = {
neovim = {
extraPackages = attrValues {
@ -26,6 +26,7 @@ in
pattern = 'yaml',
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
});
vim.api.nvim_create_autocmd('FileType', {
pattern = 'json',
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
@ -54,4 +55,8 @@ in
'';
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -9,8 +9,8 @@
cfg = config.programs.neovim;
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
in
mkIf cfg.enableIde {
in {
config = mkIf cfg.enable {
programs = {
neovim = {
extraPackages = attrValues {
@ -38,8 +38,8 @@ in
require("neodev").setup({
override = function(root_dir, library)
if root_dir:find('${flakeEnv}', 1, true) == 1 then
library.enabled = true
library.plugins = true
library.enabled = true;
library.plugins = true;
end
end,
});
@ -52,4 +52,8 @@ in
];
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -19,9 +19,7 @@ self: {
hash = "sha256-deQvQOOyK6iP7kjVrgEdFTyOP80RWXMrETs6gi7DTmo=";
};
in {
# live-server --quiet --browser=firefox --open=%outputfile% --watch=%outputfile% --wait=800
config = mkIf cfg.enableIde {
config = mkIf cfg.enable {
programs = {
neovim = {
extraPackages = attrValues {
@ -165,5 +163,5 @@ in {
};
# For accurate stack trace
_file = ./markdown.nix;
_file = ./default.nix;
}

View file

@ -18,13 +18,10 @@ self: {
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
flakeDir = "${removePrefix "/home/${cfg.user}/" flakeEnv}";
in {
config = mkIf cfg.enableIde {
config = mkIf cfg.enable {
assertions = [
{
assertion =
cfg.enableIde
&& hasPrefix "/home/${cfg.user}/" flakeEnv
|| !cfg.enableIde;
assertion = hasPrefix "/home/${cfg.user}/" flakeEnv;
message = ''
Your $FLAKE environment variable needs to point to a directory in
the main users' home to use the neovim module.
@ -79,5 +76,5 @@ in {
};
# For accurate stack trace
_file = ./nix.nix;
_file = ./default.nix;
}

View file

@ -7,23 +7,20 @@
inherit (lib) attrValues mkIf;
cfg = config.programs.neovim;
in {
config = mkIf cfg.enableIde {
programs = {
neovim = {
withPython3 = true;
extraPython3Packages = py:
pythonPkgs = py:
(attrValues {
inherit (py) python-lsp-server;
})
++ py.python-lsp-server.optional-dependencies.all;
in {
config = mkIf cfg.enable {
programs = {
neovim = {
withPython3 = true;
extraPackages =
(attrValues {
inherit (pkgs.python3Packages) python-lsp-server;
})
++ pkgs.python3Packages.python-lsp-server.optional-dependencies.all;
extraPython3Packages = pythonPkgs;
extraPackages = pythonPkgs pkgs.python3Packages;
extraLuaConfig =
# lua
@ -45,4 +42,7 @@ in {
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -7,8 +7,8 @@
inherit (lib) attrValues mkIf;
cfg = config.programs.neovim;
in
mkIf cfg.enableIde {
in {
config = mkIf cfg.enable {
programs = {
neovim = {
extraPackages = attrValues {
@ -35,4 +35,8 @@ in
'';
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -11,7 +11,7 @@ self: {
cfg = config.programs.neovim;
in {
config = mkIf cfg.enableIde {
config = mkIf cfg.enable {
programs = {
neovim = {
withNodeJs = true;
@ -200,5 +200,5 @@ in {
};
# For accurate stack trace
_file = ./web.nix;
_file = ./default.nix;
}

View file

@ -5,19 +5,19 @@ self: {
...
}: let
inherit (self.inputs) nvim-theme-src;
inherit (lib) attrValues fileContents optionals;
inherit (lib) attrValues fileContents mkIf;
cfg = config.programs.neovim;
in {
imports = [./treesitter.nix];
config.programs.neovim = {
config = mkIf cfg.enable {
programs.neovim = {
extraPackages = attrValues {
inherit (pkgs) bat;
};
plugins =
[
plugins = [
{
plugin = pkgs.vimPlugins.dracula-nvim.overrideAttrs {
src = nvim-theme-src;
@ -100,8 +100,7 @@ in {
type = "lua";
config = fileContents ./config/heirline.lua;
}
]
++ optionals cfg.enableIde [
{
plugin = pkgs.vimPlugins.neo-tree-nvim;
type = "lua";
@ -177,7 +176,8 @@ in {
}
];
};
};
# For accurate stack trace
_file = ./theme.nix;
_file = ./default.nix;
}

View file

@ -1,4 +1,14 @@
{pkgs, ...}: {
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
cfg = config.programs.neovim;
in {
config = mkIf cfg.enable {
programs.neovim.plugins = [
{
plugin = pkgs.vimPlugins.nvim-treesitter-context;
@ -31,4 +41,8 @@
'';
}
];
};
# For accurate stack trace
_file = ./treesitter.nix;
}