221 lines
6.4 KiB
Nix
221 lines
6.4 KiB
Nix
# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project
|
|
# TODO: just install these things, then symlink to mason's bin directory
|
|
# One thing to consider, though, /nix/store of `nix-shell` or `nix-develop`
|
|
# might be different from `home-manager`'s (~/.nix_profile/bin/jq)
|
|
{
|
|
inputs,
|
|
cell,
|
|
namespace,
|
|
}: {
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}: let
|
|
inherit (inputs.nixpkgs) system;
|
|
# NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace
|
|
# and is added to the path after wrapping.
|
|
# check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand`
|
|
# see: :/--suffix.*PATH
|
|
# there should be mentions of additional packages
|
|
# my_neovim = pkgs.neovim-unwrapped;
|
|
|
|
my_neovim = inputs.neovim-nightly-overlay.packages.${system}.neovim;
|
|
# These are added to the wrapper. Which means `which zk` is likely to show only
|
|
# within neovim's environment
|
|
nvim_pkgs =
|
|
[
|
|
# pkgs.gccStdenv
|
|
pkgs.tree-sitter
|
|
pkgs.fzf # file name fuzzy search
|
|
pkgs.ripgrep # content fuzzy search
|
|
# pkgs.zk # Zettelkasten (limited support)
|
|
pkgs.fd # Required by a Telescope plugin (?)
|
|
pkgs.stdenv.cc.cc.lib
|
|
pkgs.nil # oxalica's better nix language server
|
|
inputs.nix-boost.packages."${system}".rust4cargo
|
|
# inputs.sg-nvim.packages.${system}.default
|
|
|
|
pkgs.go # doesn't work, Mason installs from runtime path
|
|
|
|
# Helps Mason on requirements of manual interpreter installations
|
|
pkgs.nodejs
|
|
pkgs.python3
|
|
|
|
# Language-specific stuffs
|
|
pkgs.python3Packages.pylint
|
|
pkgs.python3Packages.flake8
|
|
# FIXME: installing ansible from here just doesn't work :/
|
|
# pkgs.ansible-lint
|
|
# pkgs.python38Packages.ansible
|
|
# pkgs.ansible-language-server
|
|
# TODO: the devShell should provide rust-analyzer so that
|
|
# cargo test builds binaries compatible with rust-analyzer
|
|
|
|
# pkgs.rust-analyzer
|
|
# rust_pkgs
|
|
# pkgs.evcxr # Rust REPL for Conjure!
|
|
]
|
|
++ lib.optionals (pkgs.stdenv.isDarwin) (
|
|
let
|
|
inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation;
|
|
in [
|
|
System
|
|
CoreFoundation
|
|
]
|
|
);
|
|
in {
|
|
options.base.neovim = {
|
|
enable = lib.mkOption {
|
|
default = true;
|
|
description = "enable personalized neovim as default editor";
|
|
type = lib.types.bool;
|
|
example = false;
|
|
};
|
|
};
|
|
config = lib.mkIf config.base.neovim.enable {
|
|
# home-manager
|
|
programs.neovim = {
|
|
enable = true;
|
|
package = my_neovim;
|
|
viAlias = true;
|
|
vimAlias = true;
|
|
# withPython3 = true;
|
|
# withNodeJs = true;
|
|
# NOTE: this adds path to the wrapped version of neovim
|
|
extraPackages = nvim_pkgs;
|
|
extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua";
|
|
/*
|
|
* type: (either derivation pluginWithConfigType)
|
|
* pluginWithConfigType {
|
|
* config: nullOr lines,
|
|
* type: enum[],
|
|
* optional: (mkType (mkDefault false) bool), # Don't load by default (:packadd)
|
|
* plugin: package,
|
|
* runtime: (mkType (mkDefault {}) {?})
|
|
* }
|
|
*/
|
|
plugins = let
|
|
inherit (cell.lib.deprecate) mkDeprecate deprecate-seq-handler;
|
|
inherit
|
|
(inputs.nixpkgs-vimplugins.legacyPackages.${system}.vimPlugins)
|
|
plenary-nvim
|
|
nvim-treesitter
|
|
nvim-treesitter-textobjects
|
|
nvim-treesitter-context
|
|
telescope-fzf-native-nvim
|
|
telescope-file-browser-nvim
|
|
telescope-nvim
|
|
nvim-lspconfig
|
|
gruvbox-community
|
|
neodev-nvim
|
|
cmp-nvim-lsp
|
|
cmp-path
|
|
cmp-buffer
|
|
cmp-cmdline
|
|
nvim-cmp
|
|
lspkind-nvim
|
|
nvim-autopairs
|
|
nvim-ts-autotag
|
|
guess-indent-nvim
|
|
harpoon
|
|
luasnip
|
|
fidget-nvim
|
|
rust-tools-nvim
|
|
cmp_luasnip
|
|
gitsigns-nvim
|
|
indent-blankline-nvim
|
|
lualine-nvim
|
|
mason-lspconfig-nvim
|
|
mason-nvim
|
|
neogit
|
|
nvim-jqx
|
|
nvim-surround
|
|
nvim-web-devicons
|
|
playground
|
|
todo-comments-nvim
|
|
comment-nvim
|
|
trouble-nvim
|
|
vim-dispatch
|
|
vim-dispatch-neovim
|
|
vim-fugitive
|
|
vim-jack-in
|
|
nui-nvim
|
|
telescope-live-grep-args-nvim
|
|
nvim-colorizer-lua
|
|
git-worktree-nvim
|
|
;
|
|
sg-nvim = let
|
|
_sg = inputs.cells.dotfiles.packages.sg-nvim;
|
|
in {
|
|
plugin = _sg;
|
|
# NOTE: Wait, this mean the plugin is exclusively lua only since package.cpath is Lua API
|
|
config = ''
|
|
package.cpath = package.cpath .. ";${_sg}/lib/*.so;${_sg}/lib/*.dylib"
|
|
'';
|
|
type = "lua";
|
|
};
|
|
in
|
|
deprecate-seq-handler 1 [
|
|
(mkDeprecate {inherit sg-nvim;} {
|
|
stage = 2;
|
|
meta.since = "2023-10-20";
|
|
})
|
|
(mkDeprecate {inherit vim-jack-in;} {
|
|
stage = 2;
|
|
meta.since = "2023-10-20";
|
|
})
|
|
plenary-nvim
|
|
nvim-treesitter.withAllGrammars
|
|
nvim-treesitter-textobjects
|
|
telescope-fzf-native-nvim
|
|
telescope-file-browser-nvim
|
|
telescope-nvim
|
|
nvim-lspconfig
|
|
gruvbox-community
|
|
neodev-nvim
|
|
cmp-nvim-lsp
|
|
cmp-path
|
|
cmp-buffer
|
|
cmp-cmdline
|
|
nvim-cmp
|
|
lspkind-nvim
|
|
nvim-autopairs
|
|
nvim-ts-autotag
|
|
guess-indent-nvim
|
|
harpoon
|
|
luasnip
|
|
nvim-treesitter-context
|
|
fidget-nvim
|
|
rust-tools-nvim
|
|
telescope-live-grep-args-nvim
|
|
comment-nvim
|
|
|
|
cmp_luasnip
|
|
gitsigns-nvim
|
|
indent-blankline-nvim
|
|
lualine-nvim
|
|
mason-lspconfig-nvim
|
|
mason-nvim
|
|
neogit
|
|
nvim-jqx
|
|
nvim-surround
|
|
nvim-web-devicons
|
|
playground
|
|
todo-comments-nvim
|
|
trouble-nvim
|
|
vim-dispatch
|
|
vim-dispatch-neovim
|
|
vim-fugitive
|
|
nvim-colorizer-lua
|
|
git-worktree-nvim
|
|
(mkDeprecate {inherit nui-nvim;} {
|
|
stage = 2;
|
|
meta.since = "2023-10-20";
|
|
})
|
|
];
|
|
};
|
|
# home.packages = nvim_pkgs;
|
|
};
|
|
}
|