2023-11-22 15:33:16 -05:00
|
|
|
{
|
2023-12-08 12:50:38 -05:00
|
|
|
config,
|
2023-11-22 15:33:16 -05:00
|
|
|
pkgs,
|
|
|
|
lib,
|
2024-01-23 09:06:09 -05:00
|
|
|
nvim-theme-src,
|
|
|
|
coc-stylelintplus,
|
2024-04-22 11:40:48 -04:00
|
|
|
nixd,
|
2024-04-20 19:20:49 -04:00
|
|
|
vimplugin-easytables-src,
|
2024-03-11 09:12:47 -04:00
|
|
|
vimplugin-riscv-src,
|
2023-11-22 15:33:16 -05:00
|
|
|
...
|
2024-01-22 11:09:37 -05:00
|
|
|
}: let
|
2024-04-22 11:40:48 -04:00
|
|
|
inherit (config.vars) hostName mainUser neovimIde;
|
2024-05-01 10:21:27 -04:00
|
|
|
inherit (lib) fileContents hasPrefix optionalAttrs optionals removePrefix;
|
2023-12-01 12:39:16 -05:00
|
|
|
|
|
|
|
javaSdk = pkgs.temurin-bin-17;
|
2024-01-23 09:06:09 -05:00
|
|
|
coc-stylelintplus-flake = coc-stylelintplus.packages.${pkgs.system}.default;
|
2024-04-22 11:40:48 -04:00
|
|
|
nixdPkg = nixd.packages.${pkgs.system}.default;
|
|
|
|
|
2024-04-22 15:14:22 -04:00
|
|
|
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
|
2024-04-22 11:40:48 -04:00
|
|
|
flakeDir = "${removePrefix "/home/${mainUser}/" flakeEnv}";
|
2023-10-27 01:15:33 -04:00
|
|
|
in {
|
2024-04-22 11:40:48 -04:00
|
|
|
assertions = [
|
|
|
|
{
|
2024-04-22 15:27:11 -04:00
|
|
|
assertion = neovimIde && hasPrefix "/home/${mainUser}/" flakeEnv || !neovimIde;
|
|
|
|
message = ''
|
2024-04-22 11:40:48 -04:00
|
|
|
Your $FLAKE environment variable needs to point to a directory in
|
|
|
|
the main users' home to use the neovim module.
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2024-01-09 13:13:04 -05:00
|
|
|
home = optionalAttrs neovimIde {
|
2023-12-08 14:59:44 -05:00
|
|
|
packages = with pkgs; [
|
|
|
|
gradle
|
2024-02-12 16:16:33 -05:00
|
|
|
maven
|
2023-12-08 14:59:44 -05:00
|
|
|
alejandra
|
2024-04-22 11:40:48 -04:00
|
|
|
|
|
|
|
# FIXME: set nixd to use alejandra
|
|
|
|
(writeShellApplication {
|
|
|
|
name = "nixpkgs-fmt";
|
|
|
|
runtimeInputs = [alejandra];
|
|
|
|
text = "alejandra \"$@\"";
|
|
|
|
})
|
2023-12-08 14:59:44 -05:00
|
|
|
];
|
2024-04-22 13:51:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
xdg.dataFile = optionalAttrs neovimIde {
|
|
|
|
".gradle/gradle.properties".text = ''
|
|
|
|
org.gradle.java.home = ${javaSdk}
|
|
|
|
'';
|
2024-04-22 11:40:48 -04:00
|
|
|
|
2024-04-22 13:51:31 -04:00
|
|
|
"${flakeDir}/.nixd.json".text = builtins.toJSON {
|
2024-04-22 11:40:48 -04:00
|
|
|
nixpkgs = {
|
|
|
|
expr = "import (builtins.getFlake \"${flakeDir}\").inputs.nixpkgs {}";
|
|
|
|
};
|
|
|
|
options.nixos = {
|
|
|
|
expr = "(builtins.getFlake \"${flakeDir}\").nixosConfigurations.${hostName}.options";
|
|
|
|
};
|
|
|
|
};
|
2023-12-08 14:59:44 -05:00
|
|
|
};
|
2023-10-22 15:35:25 -04:00
|
|
|
|
2023-10-15 15:11:59 -04:00
|
|
|
programs = {
|
2024-01-09 13:13:04 -05:00
|
|
|
java = optionalAttrs neovimIde {
|
2023-09-19 12:54:00 -04:00
|
|
|
enable = true;
|
2023-12-01 12:39:16 -05:00
|
|
|
package = javaSdk;
|
|
|
|
};
|
|
|
|
|
|
|
|
# I love doing typos
|
|
|
|
bash.shellAliases = {
|
|
|
|
nivm = "nvim";
|
|
|
|
nivim = "nvim";
|
2023-10-15 15:11:59 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
neovim = {
|
|
|
|
enable = true;
|
2023-10-26 16:33:40 -04:00
|
|
|
withNodeJs = true;
|
|
|
|
withPython3 = true;
|
|
|
|
withRuby = false;
|
|
|
|
|
2023-10-26 00:35:24 -04:00
|
|
|
defaultEditor = true;
|
2023-10-15 15:11:59 -04:00
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
|
|
|
|
2023-12-08 12:50:38 -05:00
|
|
|
extraPackages = with pkgs; ([
|
|
|
|
bat
|
|
|
|
gcc
|
|
|
|
]
|
2024-01-09 13:13:04 -05:00
|
|
|
++ optionals neovimIde [
|
2024-04-18 08:26:22 -04:00
|
|
|
clang-tools
|
2023-12-08 12:50:38 -05:00
|
|
|
nodejs_latest
|
|
|
|
nodePackages.npm
|
|
|
|
nodePackages.neovim
|
|
|
|
gradle
|
2024-04-22 11:40:48 -04:00
|
|
|
nixdPkg
|
2023-12-08 12:50:38 -05:00
|
|
|
]);
|
|
|
|
|
|
|
|
extraPython3Packages = ps:
|
2024-01-09 13:13:04 -05:00
|
|
|
optionals neovimIde [
|
2023-12-08 12:50:38 -05:00
|
|
|
ps.pylint
|
|
|
|
];
|
|
|
|
|
2024-01-09 13:13:04 -05:00
|
|
|
coc = optionalAttrs neovimIde {
|
2023-10-15 15:11:59 -04:00
|
|
|
enable = true;
|
|
|
|
settings = {
|
2023-10-26 16:33:40 -04:00
|
|
|
# General
|
2023-11-22 16:22:00 -05:00
|
|
|
colors.enable = true;
|
|
|
|
coc.preferences.formatOnType = true;
|
|
|
|
diagnostic.checkCurrentLine = true;
|
|
|
|
inlayHint.enable = false;
|
2023-10-20 21:06:44 -04:00
|
|
|
|
2023-11-22 16:22:00 -05:00
|
|
|
# ESLint
|
|
|
|
eslint = {
|
|
|
|
format.enable = true;
|
|
|
|
autoFixOnSave = true;
|
|
|
|
};
|
2023-10-26 16:33:40 -04:00
|
|
|
|
2023-10-27 01:15:33 -04:00
|
|
|
# Stylelint
|
2023-11-22 16:22:00 -05:00
|
|
|
stylelintplus = {
|
|
|
|
enable = true;
|
|
|
|
cssInJs = true;
|
|
|
|
autoFixOnSave = true;
|
|
|
|
autoFixOnFormat = true;
|
|
|
|
};
|
|
|
|
css.validate = false;
|
|
|
|
less.validate = false;
|
|
|
|
scss.validate = false;
|
|
|
|
wxss.validate = false;
|
2023-10-20 21:06:44 -04:00
|
|
|
|
2023-11-22 16:22:00 -05:00
|
|
|
# Lua
|
|
|
|
Lua = {
|
|
|
|
misc.parameters = [
|
|
|
|
"--metapath"
|
|
|
|
"~/.cache/sumneko_lua/meta"
|
|
|
|
"--logpath"
|
|
|
|
"~/.cache/sumneko_lua/log"
|
|
|
|
];
|
|
|
|
workspace.library = [
|
|
|
|
"$\{3rd\}/luv/library"
|
|
|
|
];
|
|
|
|
};
|
2023-10-15 15:11:59 -04:00
|
|
|
sumneko-lua = {
|
|
|
|
serverDir = "${pkgs.lua-language-server}/share/lua-language-server";
|
|
|
|
enableNvimLuaDev = true;
|
|
|
|
};
|
2023-10-20 21:06:44 -04:00
|
|
|
|
2023-10-15 15:11:59 -04:00
|
|
|
languageserver = {
|
2023-11-22 16:22:00 -05:00
|
|
|
# Nix
|
2023-10-15 15:11:59 -04:00
|
|
|
nix = {
|
2024-04-22 11:40:48 -04:00
|
|
|
command = "nixd";
|
2023-11-22 15:33:16 -05:00
|
|
|
filetypes = ["nix"];
|
2023-10-15 15:11:59 -04:00
|
|
|
};
|
2023-09-19 12:54:00 -04:00
|
|
|
};
|
2023-10-26 16:33:40 -04:00
|
|
|
|
2023-11-22 16:22:00 -05:00
|
|
|
# Java
|
2024-02-01 19:39:16 -05:00
|
|
|
java = {
|
|
|
|
maven.downloadSources = true;
|
|
|
|
eclipse.downloadSources = true;
|
|
|
|
|
|
|
|
format.settings.url = "eclipse-formatter.xml";
|
|
|
|
|
|
|
|
jdt.ls = {
|
|
|
|
java.home = "${javaSdk}";
|
|
|
|
statusIcons = {
|
|
|
|
"busy" = "Busy";
|
|
|
|
"ready" = "OK";
|
|
|
|
"warning" = "Warning";
|
|
|
|
"error" = "Error";
|
|
|
|
};
|
2023-11-22 16:22:00 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Bash
|
|
|
|
bashIde.shellcheckPath = "${pkgs.shellcheck}/bin/shellcheck";
|
2023-12-07 16:10:54 -05:00
|
|
|
|
|
|
|
markdownlint.config = {
|
|
|
|
no-trailing-spaces = true;
|
|
|
|
no-multiple-blanks = false;
|
|
|
|
no-duplicate-heading = false;
|
2024-04-20 15:09:03 -04:00
|
|
|
line-length = {
|
|
|
|
tables = false;
|
|
|
|
};
|
2023-12-07 16:10:54 -05:00
|
|
|
};
|
2023-09-19 12:54:00 -04:00
|
|
|
};
|
|
|
|
};
|
2023-10-03 11:08:56 -04:00
|
|
|
|
2023-10-27 01:15:33 -04:00
|
|
|
extraConfig = fileContents ./base.vim;
|
2023-11-22 15:33:16 -05:00
|
|
|
extraLuaConfig = fileContents ./base.lua;
|
2023-10-15 15:11:59 -04:00
|
|
|
|
2023-12-22 21:50:58 -05:00
|
|
|
plugins = with pkgs.vimPlugins;
|
|
|
|
([
|
|
|
|
fzfWrapper
|
|
|
|
fzf-vim
|
|
|
|
fugitive
|
2023-12-08 12:50:38 -05:00
|
|
|
|
2023-12-22 21:50:58 -05:00
|
|
|
{
|
2024-01-23 09:06:09 -05:00
|
|
|
plugin = dracula-nvim.overrideAttrs {
|
|
|
|
src = nvim-theme-src;
|
|
|
|
};
|
2023-12-22 21:50:58 -05:00
|
|
|
type = "viml";
|
|
|
|
config = fileContents ./plugins/dracula.vim;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = todo-comments-nvim;
|
|
|
|
type = "lua";
|
2024-01-08 11:25:18 -05:00
|
|
|
config =
|
|
|
|
/*
|
|
|
|
lua
|
|
|
|
*/
|
|
|
|
''require('todo-comments').setup()'';
|
2023-12-22 21:50:58 -05:00
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = gitsigns-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = fileContents ./plugins/gitsigns.lua;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = indent-blankline-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = fileContents ./plugins/indent.lua;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = mini-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = fileContents ./plugins/mini.lua;
|
|
|
|
}
|
2024-04-21 02:00:39 -04:00
|
|
|
{
|
|
|
|
plugin = codewindow-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = fileContents ./plugins/codewindow.lua;
|
|
|
|
}
|
2023-12-22 21:50:58 -05:00
|
|
|
]
|
2024-01-09 13:13:04 -05:00
|
|
|
++ optionals neovimIde [
|
2024-01-17 20:16:26 -05:00
|
|
|
markdown-preview-nvim
|
|
|
|
|
2023-12-22 21:50:58 -05:00
|
|
|
# Coc configured
|
2024-04-18 08:26:22 -04:00
|
|
|
coc-clangd
|
|
|
|
coc-cmake
|
2023-12-22 21:50:58 -05:00
|
|
|
coc-css
|
|
|
|
coc-eslint
|
|
|
|
coc-java
|
|
|
|
coc-sh
|
2024-01-23 09:06:09 -05:00
|
|
|
coc-stylelintplus-flake
|
2023-12-22 21:50:58 -05:00
|
|
|
{
|
|
|
|
plugin = coc-snippets;
|
|
|
|
type = "viml";
|
|
|
|
config = fileContents ./plugins/snippets.vim;
|
|
|
|
}
|
|
|
|
|
|
|
|
## Lua
|
|
|
|
coc-sumneko-lua
|
|
|
|
neodev-nvim
|
2023-12-08 12:50:38 -05:00
|
|
|
|
2023-12-22 21:50:58 -05:00
|
|
|
## Fzf
|
|
|
|
coc-fzf
|
2023-12-08 12:50:38 -05:00
|
|
|
|
2023-12-22 21:50:58 -05:00
|
|
|
coc-highlight
|
|
|
|
coc-json
|
|
|
|
coc-pyright
|
|
|
|
coc-vimlsp
|
|
|
|
coc-yaml
|
|
|
|
coc-toml
|
|
|
|
coc-markdownlint
|
|
|
|
coc-tsserver
|
2023-12-08 12:50:38 -05:00
|
|
|
|
2023-12-27 11:39:38 -05:00
|
|
|
{
|
|
|
|
plugin = nvim-autopairs;
|
|
|
|
type = "lua";
|
|
|
|
config = fileContents ./plugins/autopairs.lua;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = lualine-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = fileContents ./plugins/lualine.lua;
|
|
|
|
}
|
2023-12-22 21:50:58 -05:00
|
|
|
{
|
|
|
|
plugin = neo-tree-nvim;
|
|
|
|
type = "viml";
|
|
|
|
config = ''
|
|
|
|
${fileContents ./plugins/neotree.vim}
|
2023-12-08 12:50:38 -05:00
|
|
|
|
2023-12-22 21:50:58 -05:00
|
|
|
lua << EOF
|
|
|
|
${fileContents ./plugins/neotree.lua}
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
}
|
2024-03-11 09:12:47 -04:00
|
|
|
(pkgs.vimUtils.buildVimPlugin {
|
|
|
|
name = "riscv-asm";
|
2024-04-20 19:20:49 -04:00
|
|
|
version = vimplugin-riscv-src.shortRev;
|
2024-03-11 09:12:47 -04:00
|
|
|
src = vimplugin-riscv-src;
|
|
|
|
})
|
2024-04-20 19:20:49 -04:00
|
|
|
{
|
2024-04-21 02:00:39 -04:00
|
|
|
plugin = pkgs.vimUtils.buildVimPlugin {
|
2024-04-20 19:20:49 -04:00
|
|
|
name = "easytables-nvim";
|
|
|
|
version = vimplugin-easytables-src.shortRev;
|
|
|
|
src = vimplugin-easytables-src;
|
2024-04-21 02:00:39 -04:00
|
|
|
};
|
2024-04-20 19:20:49 -04:00
|
|
|
type = "lua";
|
|
|
|
config = ''require("easytables").setup();'';
|
|
|
|
}
|
2023-12-22 21:50:58 -05:00
|
|
|
])
|
|
|
|
# Treesitter
|
|
|
|
++ (with pkgs.vimPlugins; [
|
|
|
|
nvim-treesitter-context
|
|
|
|
nvim-treesitter-textobjects
|
2023-12-08 12:50:38 -05:00
|
|
|
{
|
|
|
|
type = "viml";
|
2023-12-22 21:50:58 -05:00
|
|
|
config = fileContents ./plugins/treesitter.vim;
|
|
|
|
plugin = nvim-treesitter.withPlugins (p: [
|
|
|
|
p.awk
|
|
|
|
p.bash
|
|
|
|
p.c
|
|
|
|
p.c_sharp
|
|
|
|
p.cairo
|
|
|
|
p.cmake
|
|
|
|
p.comment
|
|
|
|
p.cpp
|
|
|
|
p.css
|
|
|
|
p.csv
|
|
|
|
p.cuda
|
|
|
|
p.diff
|
|
|
|
p.dockerfile
|
|
|
|
p.dot
|
|
|
|
p.git_config
|
|
|
|
p.git_rebase
|
|
|
|
p.gitattributes
|
|
|
|
p.gitcommit
|
|
|
|
p.gitignore
|
|
|
|
p.go
|
|
|
|
p.gomod
|
|
|
|
p.gosum
|
|
|
|
p.groovy
|
|
|
|
p.haskell
|
|
|
|
p.haskell_persistent
|
2024-02-19 09:53:55 -05:00
|
|
|
p.hyprlang
|
2023-12-22 21:50:58 -05:00
|
|
|
p.html
|
|
|
|
p.ini
|
|
|
|
p.java
|
|
|
|
p.javascript
|
|
|
|
p.jq
|
|
|
|
p.jsdoc
|
|
|
|
p.json
|
|
|
|
p.json5
|
|
|
|
p.jsonc
|
|
|
|
p.jsonnet
|
|
|
|
p.kotlin
|
|
|
|
p.latex
|
|
|
|
p.lua
|
|
|
|
p.luadoc
|
|
|
|
p.make
|
|
|
|
p.markdown
|
|
|
|
p.meson
|
|
|
|
p.ninja
|
|
|
|
p.nix
|
|
|
|
p.passwd
|
|
|
|
p.perl
|
|
|
|
p.php
|
|
|
|
p.phpdoc
|
|
|
|
p.properties
|
|
|
|
p.python
|
|
|
|
p.rasi
|
|
|
|
p.regex
|
|
|
|
p.requirements
|
|
|
|
p.ruby
|
|
|
|
p.rust
|
|
|
|
p.scss
|
|
|
|
p.sql
|
|
|
|
p.ssh_config
|
|
|
|
p.toml
|
|
|
|
p.todotxt
|
|
|
|
p.typescript
|
|
|
|
p.udev
|
|
|
|
p.vim
|
|
|
|
p.vimdoc
|
|
|
|
p.vue
|
|
|
|
p.xml
|
|
|
|
p.yaml
|
|
|
|
]);
|
2023-12-08 12:50:38 -05:00
|
|
|
}
|
|
|
|
]);
|
2023-10-15 15:11:59 -04:00
|
|
|
};
|
2023-07-19 21:52:35 -04:00
|
|
|
};
|
|
|
|
}
|