refactor: replace 'with' with attrValues

This commit is contained in:
matt1432 2024-08-31 19:16:06 -04:00
parent b47c11362d
commit 194c140dc1
56 changed files with 675 additions and 608 deletions

View file

@ -46,9 +46,9 @@
config.theme = "dracula-bat";
themes.dracula-bat.src = self.legacyPackages.${pkgs.system}.dracula.bat;
extraPackages = with pkgs.bat-extras; [
batman
];
extraPackages = builtins.attrValues {
inherit (pkgs.bat-extras) batman;
};
};
};
}

View file

@ -59,10 +59,10 @@ in {
};
};
home.packages = with pkgs; [
(writeShellApplication {
home.packages = [
(pkgs.writeShellApplication {
name = "chore";
runtimeInputs = [git];
runtimeInputs = [pkgs.git];
text = ''
DIR=''${1:-"$FLAKE"}

View file

@ -2,9 +2,7 @@
config,
pkgs,
...
}: let
inherit (pkgs) vimPlugins;
in {
}: {
imports = [
./git.nix
./langs
@ -63,11 +61,11 @@ in {
'';
plugins = [
vimPlugins.fzfWrapper
vimPlugins.fzf-vim
pkgs.vimPlugins.fzfWrapper
pkgs.vimPlugins.fzf-vim
{
plugin = vimPlugins.todo-comments-nvim;
plugin = pkgs.vimPlugins.todo-comments-nvim;
type = "lua";
config =
# lua
@ -76,7 +74,7 @@ in {
'';
}
{
plugin = vimPlugins.mini-nvim;
plugin = pkgs.vimPlugins.mini-nvim;
type = "lua";
config =
# lua

View file

@ -1,13 +1,11 @@
{pkgs, ...}: let
inherit (pkgs) vimPlugins;
in {
{pkgs, ...}: {
programs = {
neovim = {
plugins = [
vimPlugins.fugitive
pkgs.vimPlugins.fugitive
{
plugin = vimPlugins.gitsigns-nvim;
plugin = pkgs.vimPlugins.gitsigns-nvim;
type = "lua";
config =
# lua

View file

@ -4,6 +4,7 @@
lib,
...
}: let
inherit (lib) getExe mkIf;
inherit (config.vars) neovimIde;
in {
programs = {
@ -18,13 +19,13 @@ in {
viAlias = true;
vimAlias = true;
extraPackages = lib.mkIf neovimIde [
extraPackages = mkIf neovimIde [
pkgs.nodePackages.bash-language-server
pkgs.shellcheck
];
extraLuaConfig =
lib.mkIf neovimIde
mkIf neovimIde
# lua
''
vim.api.nvim_create_autocmd('FileType', {
@ -37,7 +38,7 @@ in {
settings = {
bashIde = {
shellcheckPath = '${lib.getExe pkgs.shellcheck}',
shellcheckPath = '${getExe pkgs.shellcheck}',
},
},
});

View file

@ -4,17 +4,20 @@
lib,
...
}: let
inherit (lib) mkIf;
inherit (config.vars) neovimIde;
inherit (pkgs) vimPlugins;
in
lib.mkIf neovimIde {
mkIf neovimIde {
programs = {
neovim = {
extraPackages = with pkgs; [
gcc
clang-tools
cmake-language-server
];
extraPackages = builtins.attrValues {
inherit
(pkgs)
gcc
clang-tools
cmake-language-server
;
};
extraLuaConfig =
# lua
@ -41,9 +44,9 @@ in
});
'';
plugins = [
vimPlugins.clangd_extensions-nvim
];
plugins = builtins.attrValues {
inherit (pkgs.vimPlugins) clangd_extensions-nvim;
};
};
};
}

View file

@ -4,9 +4,8 @@
pkgs,
...
}: let
inherit (lib) fileContents mkBefore mkIf;
inherit (config.vars) neovimIde;
inherit (pkgs) vimPlugins;
inherit (lib) fileContents;
in {
imports = [
./bash.nix
@ -22,10 +21,10 @@ in {
./web.nix
];
programs = lib.mkIf neovimIde {
programs = mkIf neovimIde {
neovim = {
extraLuaConfig =
lib.mkBefore
mkBefore
# lua
''
-- Start completion / snippet stuff
@ -69,30 +68,34 @@ in {
'';
plugins =
(with vimPlugins; [
nvim-lspconfig
lsp-status-nvim
lsp_lines-nvim
cmp-buffer
cmp-nvim-lsp
cmp-path
cmp-spell
vim-vsnip
])
(builtins.attrValues {
inherit
(pkgs.vimPlugins)
nvim-lspconfig
lsp-status-nvim
lsp_lines-nvim
cmp-buffer
cmp-nvim-lsp
cmp-path
cmp-spell
vim-vsnip
;
})
++ [
{
plugin = vimPlugins.nvim-cmp;
plugin = pkgs.vimPlugins.nvim-cmp;
type = "lua";
config = fileContents ../plugins/cmp.lua;
}
{
plugin = vimPlugins.nvim-autopairs;
plugin = pkgs.vimPlugins.nvim-autopairs;
type = "lua";
config =
# lua
"require('nvim-autopairs').setup({})";
''
require('nvim-autopairs').setup({});
'';
}
];
};

View file

@ -3,9 +3,10 @@
lib,
...
}: let
inherit (lib) mkIf;
inherit (config.vars) neovimIde;
in
lib.mkIf neovimIde {
mkIf neovimIde {
programs = {
neovim = {
extraLuaConfig =

View file

@ -4,13 +4,13 @@
pkgs,
...
}: let
inherit (pkgs) vimPlugins;
inherit (lib) getExe mkIf;
inherit (config.vars) neovimIde;
javaSdk = pkgs.temurin-bin-17;
javaPkgs = with pkgs; [gradle maven];
javaPkgs = builtins.attrValues {inherit (pkgs) gradle maven;};
in
lib.mkIf neovimIde {
mkIf neovimIde {
home.packages = javaPkgs;
xdg.dataFile.".gradle/gradle.properties".text = ''
@ -38,7 +38,7 @@ in
plugins = [
{
# TOOD: setup debugger https://github.com/mfussenegger/nvim-jdtls#debugger-via-nvim-dap
plugin = vimPlugins.nvim-jdtls;
plugin = pkgs.vimPlugins.nvim-jdtls;
type = "lua";
config =
# lua
@ -48,7 +48,7 @@ in
local config = {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
cmd = { '${lib.getExe pkgs.jdt-language-server}' },
cmd = { '${getExe pkgs.jdt-language-server}' },
root_dir = vim.fs.dirname(vim.fs.find(
{ 'gradlew', '.git', 'mvnw', 'pom.xml' },
{ upward = true }

View file

@ -4,15 +4,19 @@
pkgs,
...
}: let
inherit (lib) mkIf;
inherit (config.vars) neovimIde;
in
lib.mkIf neovimIde {
mkIf neovimIde {
programs = {
neovim = {
extraPackages = [
pkgs.vscode-langservers-extracted
pkgs.yaml-language-server
];
extraPackages = builtins.attrValues {
inherit
(pkgs)
vscode-langservers-extracted
yaml-language-server
;
};
extraLuaConfig =
# lua

View file

@ -4,21 +4,21 @@
lib,
...
}: let
inherit (lib) mkIf;
inherit (config.vars) neovimIde;
inherit (pkgs) vimPlugins;
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
in
lib.mkIf neovimIde {
mkIf neovimIde {
programs = {
neovim = {
extraPackages = [
pkgs.lua-language-server
];
extraPackages = builtins.attrValues {
inherit (pkgs) lua-language-server;
};
plugins = [
{
plugin = vimPlugins.neodev-nvim;
plugin = pkgs.vimPlugins.neodev-nvim;
type = "lua";
config =
# lua

View file

@ -6,22 +6,23 @@
vimplugin-easytables-src,
...
}: let
inherit (lib) mkIf;
inherit (config.vars) neovimIde;
inherit (pkgs) vimPlugins;
inherit (import "${self}/lib" {inherit pkgs;}) buildPlugin;
in
lib.mkIf neovimIde {
mkIf neovimIde {
programs = {
neovim = {
extraPackages = [
pkgs.pandoc
# LaTeX packages
pkgs.texlab
pkgs.texliveFull
pkgs.rubber
];
extraPackages = builtins.attrValues {
inherit
(pkgs)
pandoc
texlab
texliveFull
rubber
;
};
extraLuaConfig =
# lua
@ -56,7 +57,7 @@ in
}
{
plugin = vimPlugins.knap;
plugin = pkgs.vimPlugins.knap;
type = "lua";
config =
# lua

View file

@ -6,8 +6,8 @@
self,
...
}: let
inherit (lib) getExe hasPrefix mkIf removePrefix;
inherit (config.vars) hostName mainUser neovimIde;
inherit (lib) getExe hasPrefix removePrefix;
defaultFormatter = self.formatter.${pkgs.system};
@ -16,7 +16,7 @@
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
flakeDir = "${removePrefix "/home/${mainUser}/" flakeEnv}";
in
lib.mkIf neovimIde {
mkIf neovimIde {
assertions = [
{
assertion =

View file

@ -4,9 +4,10 @@
pkgs,
...
}: let
inherit (lib) mkIf;
inherit (config.vars) neovimIde;
in
lib.mkIf neovimIde {
mkIf neovimIde {
programs = {
neovim = {
withPython3 = true;

View file

@ -4,17 +4,21 @@
lib,
...
}: let
inherit (lib) mkIf;
inherit (config.vars) neovimIde;
in
lib.mkIf neovimIde {
mkIf neovimIde {
programs = {
neovim = {
extraPackages = with pkgs; [
cargo
rustc
rust-analyzer
rustfmt
];
extraPackages = builtins.attrValues {
inherit
(pkgs)
cargo
rustc
rust-analyzer
rustfmt
;
};
extraLuaConfig =
# lua

View file

@ -6,23 +6,29 @@
vimplugin-ts-error-translator-src,
...
}: let
inherit (lib) mkIf;
inherit (config.vars) neovimIde;
inherit (pkgs) vimPlugins;
inherit (import "${self}/lib" {inherit pkgs;}) buildPlugin;
in
lib.mkIf neovimIde {
mkIf neovimIde {
programs = {
neovim = {
withNodeJs = true;
extraPackages = [
pkgs.nodejs_latest
pkgs.nodePackages.npm
pkgs.nodePackages.neovim
extraPackages = builtins.attrValues {
inherit
(pkgs)
nodejs_latest
vscode-langservers-extracted
;
pkgs.vscode-langservers-extracted
];
inherit
(pkgs.nodePackages)
npm
neovim
;
};
extraLuaConfig =
# lua
@ -122,11 +128,11 @@ in
'';
plugins = [
vimPlugins.typescript-tools-nvim
pkgs.vimPlugins.typescript-tools-nvim
(buildPlugin "ts-error-translator" vimplugin-ts-error-translator-src)
{
plugin = vimPlugins.package-info-nvim;
plugin = pkgs.vimPlugins.package-info-nvim;
type = "lua";
config =
# lua

View file

@ -5,20 +5,19 @@
nvim-theme-src,
...
}: let
inherit (config.vars) neovimIde;
inherit (lib) fileContents optionals;
inherit (pkgs) vimPlugins;
inherit (config.vars) neovimIde;
in {
programs = {
neovim = {
extraPackages = with pkgs; [
bat
];
extraPackages = builtins.attrValues {
inherit (pkgs) bat;
};
plugins =
[
{
plugin = vimPlugins.dracula-nvim.overrideAttrs {
plugin = pkgs.vimPlugins.dracula-nvim.overrideAttrs {
src = nvim-theme-src;
};
type = "lua";
@ -43,7 +42,7 @@ in {
'';
}
{
plugin = vimPlugins.indent-blankline-nvim;
plugin = pkgs.vimPlugins.indent-blankline-nvim;
type = "lua";
config =
# lua
@ -80,21 +79,21 @@ in {
}
# Deps of heirline config
vimPlugins.nvim-web-devicons
pkgs.vimPlugins.nvim-web-devicons
{
plugin = vimPlugins.heirline-nvim;
plugin = pkgs.vimPlugins.heirline-nvim;
type = "lua";
config = fileContents ./plugins/heirline.lua;
}
]
++ optionals neovimIde [
{
plugin = vimPlugins.neo-tree-nvim;
plugin = pkgs.vimPlugins.neo-tree-nvim;
type = "lua";
config = fileContents ./plugins/neotree.lua;
}
{
plugin = vimPlugins.codewindow-nvim;
plugin = pkgs.vimPlugins.codewindow-nvim;
type = "lua";
config =
# lua
@ -123,7 +122,7 @@ in {
'';
}
{
plugin = vimPlugins.transparent-nvim;
plugin = pkgs.vimPlugins.transparent-nvim;
type = "lua";
config =
# lua

View file

@ -1,40 +1,34 @@
{pkgs, ...}: let
inherit (pkgs) vimPlugins;
in {
programs = {
neovim = {
plugins = [
{
plugin = vimPlugins.nvim-treesitter-context;
type = "lua";
config =
# lua
''
require('treesitter-context').setup({
enable = true,
max_lines = 3,
min_window_height = 20,
});
{pkgs, ...}: {
programs.neovim.plugins = [
{
plugin = pkgs.vimPlugins.nvim-treesitter-context;
type = "lua";
config =
# lua
''
require('treesitter-context').setup({
enable = true,
max_lines = 3,
min_window_height = 20,
});
vim.cmd.hi('TreesitterContextBottom', 'gui=underline guisp=Grey');
'';
}
vim.cmd.hi('TreesitterContextBottom', 'gui=underline guisp=Grey');
'';
}
vimPlugins.nvim-treesitter-textobjects
pkgs.vimPlugins.nvim-treesitter-textobjects
{
plugin = vimPlugins.nvim-treesitter.withAllGrammars;
type = "lua";
config =
# lua
''
require('nvim-treesitter.configs').setup({
highlight = { enable = true },
indent = { enable = true },
});
'';
}
];
};
};
{
plugin = pkgs.vimPlugins.nvim-treesitter.withAllGrammars;
type = "lua";
config =
# lua
''
require('nvim-treesitter.configs').setup({
highlight = { enable = true },
indent = { enable = true },
});
'';
}
];
}

View file

@ -11,7 +11,9 @@
newSession = true;
historyLimit = 30000;
plugins = with pkgs.tmuxPlugins; [dracula];
plugins = builtins.attrValues {
inherit (pkgs.tmuxPlugins) dracula;
};
extraConfig =
# bash