refactor: dependencies for both emacs & neovim

This commit is contained in:
Ryan Yin
2023-12-31 01:17:08 +08:00
parent 1efb20f534
commit e2295f350b
13 changed files with 180 additions and 194 deletions

View File

@@ -16,22 +16,6 @@
home.packages = with pkgs;
[
(python3.withPackages (
ps:
with ps; [
ipython
pandas
requests
pyquery
pyyaml
]
))
cargo # rust package manager
go
jdk17
racket-minimal # scheme language(racket cli only tools)
# db related
dbeaver
mycli
@@ -50,7 +34,6 @@
glow # markdown previewer
fzf
gdu # disk usage analyzer, required by AstroNvim
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
bfg-repo-cleaner # remove large files from git history
k6 # load testing tool
protobuf # protocol buffer compiler

View File

@@ -0,0 +1,3 @@
{mylib, ...}: {
imports = mylib.scanPaths ./.;
}

View File

@@ -96,7 +96,7 @@
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
lookup ; navigate your code and its documentation
;;lsp ; M-x vscode
lsp ; M-x vscode
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
@@ -142,7 +142,7 @@
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
json ; At least it ain't XML
;;(java +lsp) ; the poster child for carpal tunnel syndrome
(java +lsp) ; the poster child for carpal tunnel syndrome
javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
@@ -165,7 +165,7 @@
;;rest ; Emacs as a REST client
;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
;;(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
(scheme +guile) ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor

View File

@@ -0,0 +1,59 @@
{
pkgs,
astronvim,
...
}:
###############################################################################
#
# AstroNvim's configuration and all its dependencies(lsp, formatter, etc.)
#
#e#############################################################################
let
shellAliases = {
v = "nvim";
vdiff = "nvim -d";
};
in {
xdg.configFile = {
# astronvim's config
"nvim" = {
source = astronvim;
force = true;
};
# my custom astronvim config, astronvim will load it after base config
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
"astronvim/lua/user".source = ./astronvim_user;
};
home.shellAliases = shellAliases;
programs.nushell.shellAliases = shellAliases;
nixpkgs.config = {
programs.npm.npmrc = ''
prefix = ''${HOME}/.npm-global
'';
};
programs = {
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
# currently we use lazy.nvim as neovim's package manager, so comment this one.
# Install packages that will compile locally or download FHS binaries via Nix!
# and use lazy.nvim's `dir` option to specify the package directory in nix store.
# so that these plugins can work on NixOS.
#
# related project:
# https://github.com/b-src/lazy-nix-helper.nvim
plugins = with pkgs.vimPlugins; [
# search all the plugins using https://search.nixos.org/packages
telescope-fzf-native-nvim
];
};
};
}

View File

@@ -0,0 +1,115 @@
{pkgs, ...}: {
home.packages = with pkgs;
[
#-- c/c++
cmake
cmake-language-server
gnumake
checkmake
gcc # c/c++ compiler, required by nvim-treesitter!
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
lldb
#-- python
nodePackages.pyright # python language server
python3Packages.black # python formatter
python3Packages.ruff-lsp
(python310.withPackages (
ps:
with ps; [
pynvim # Python client and plugin host for Nvim
ipython
pandas
requests
pyquery
pyyaml
]
))
#-- rust
rust-analyzer
cargo # rust package manager
rustfmt
#-- zig
zls
#-- nix
nil
rnix-lsp
# nixd
statix # Lints and suggestions for the nix programming language
deadnix # Find and remove unused code in .nix source files
alejandra # Nix Code Formatter
#-- golang
go
gomodifytags
iferr # generate error handling code for go
impl # generate function implementation for go
gotools # contains tools like: godoc, goimports, etc.
gopls # go language server
delve # go debugger
# -- java
jdk17
gradle
maven
spring-boot-cli
#-- lua
stylua
lua-language-server
#-- bash
nodePackages.bash-language-server
shellcheck
shfmt
#-- javascript/typescript --#
nodePackages.nodejs
nodePackages.typescript
nodePackages.typescript-language-server
# HTML/CSS/JSON/ESLint language servers extracted from vscode
nodePackages.vscode-langservers-extracted
nodePackages."@tailwindcss/language-server"
#-- CloudNative
nodePackages.dockerfile-language-server-nodejs
# terraform # install via brew on macOS
terraform-ls
jsonnet
jsonnet-language-server
hadolint # Dockerfile linter
#-- Others
taplo # TOML language server / formatter / validator
nodePackages.yaml-language-server
sqlfluff # SQL linter
actionlint # GitHub Actions linter
buf # protoc plugin for linting and formatting
proselint # English prose linter
racket-minimal # scheme language(racket cli only tools)
#-- Misc
tree-sitter # common language parser/highlighter
nodePackages.prettier # common code formatter
marksman # language server for markdown
glow # markdown previewer
fzf
#-- Optional Requirements:
gdu # disk usage analyzer, required by AstroNvim
(ripgrep.override {withPCRE2 = true;}) # recursively searches directories for a regex pattern
]
++ (
if pkgs.stdenv.isDarwin
then []
else [
#-- verilog / systemverilog
verible
gdb
]
);
}

View File

@@ -1,173 +0,0 @@
{
pkgs,
astronvim,
...
}:
###############################################################################
#
# AstroNvim's configuration and all its dependencies(lsp, formatter, etc.)
#
#e#############################################################################
let
shellAliases = {
v = "nvim";
vdiff = "nvim -d";
};
in {
xdg.configFile = {
# astronvim's config
"nvim" = {
source = astronvim;
force = true;
};
# my custom astronvim config, astronvim will load it after base config
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
"astronvim/lua/user".source = ./astronvim_user;
};
home.shellAliases = shellAliases;
programs.nushell.shellAliases = shellAliases;
nixpkgs.config = {
programs.npm.npmrc = ''
prefix = ''${HOME}/.npm-global
'';
};
programs = {
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
# currently we use lazy.nvim as neovim's package manager, so comment this one.
# Install packages that will compile locally or download FHS binaries via Nix!
# and use lazy.nvim's `dir` option to specify the package directory in nix store.
# so that these plugins can work on NixOS.
#
# related project:
# https://github.com/b-src/lazy-nix-helper.nvim
plugins = with pkgs.vimPlugins; [
# search all the plugins using https://search.nixos.org/packages
telescope-fzf-native-nvim
];
# Extra packages only available to nvim(won't pollute the global home environment)
extraPackages = with pkgs;
[
#-- c/c++
cmake
cmake-language-server
gnumake
checkmake
gcc # c/c++ compiler, required by nvim-treesitter!
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
lldb
#-- python
nodePackages.pyright # python language server
python3Packages.black # python formatter
python3Packages.ruff-lsp
(python3.withPackages (
ps:
with ps; [
pynvim # Python client and plugin host for Nvim
ipython
pandas
requests
pyquery
pyyaml
]
))
#-- rust
rust-analyzer
cargo # rust package manager
rustfmt
#-- zig
zls
#-- nix
nil
rnix-lsp
# nixd
statix # Lints and suggestions for the nix programming language
deadnix # Find and remove unused code in .nix source files
alejandra # Nix Code Formatter
#-- golang
go
gomodifytags
iferr # generate error handling code for go
impl # generate function implementation for go
gotools # contains tools like: godoc, goimports, etc.
gopls # go language server
delve # go debugger
# -- java
jdk17
gradle
maven
spring-boot-cli
#-- lua
stylua
lua-language-server
#-- bash
nodePackages.bash-language-server
shellcheck
shfmt
#-- javascript/typescript --#
nodePackages.nodejs
nodePackages.typescript
nodePackages.typescript-language-server
# HTML/CSS/JSON/ESLint language servers extracted from vscode
nodePackages.vscode-langservers-extracted
nodePackages."@tailwindcss/language-server"
#-- CloudNative
nodePackages.dockerfile-language-server-nodejs
# terraform # install via brew on macOS
terraform-ls
jsonnet
jsonnet-language-server
hadolint # Dockerfile linter
#-- Others
taplo # TOML language server / formatter / validator
nodePackages.yaml-language-server
sqlfluff # SQL linter
actionlint # GitHub Actions linter
buf # protoc plugin for linting and formatting
proselint # English prose linter
#-- Misc
tree-sitter # common language parser/highlighter
nodePackages.prettier # common code formatter
marksman # language server for markdown
glow # markdown previewer
fzf
#-- Optional Requirements:
gdu # disk usage analyzer, required by AstroNvim
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
]
++ (
if pkgs.stdenv.isDarwin
then []
else [
#-- verilog / systemverilog
verible
gdb
]
);
};
};
}

View File

@@ -25,7 +25,6 @@
gnumake
just # a command runner like make, but simpler
gawk # GNU awk, a pattern scanning and processing language
(ripgrep.override {withPCRE2 = true;}) # recursively searches directories for a regex pattern
sad # CLI search and replace, with diff preview, really useful!!!
delta # A viewer for git and diff output
# A fast and polyglot tool for code searching, linting, rewriting at large scale