viminal2/flake.nix

274 lines
7.3 KiB
Nix
Raw Permalink Normal View History

2024-10-09 17:13:16 -07:00
{
2024-10-11 13:13:54 -07:00
description = "A Neovim configuration for the stubborn Nixian hacker";
2024-10-09 17:13:16 -07:00
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
2024-10-27 17:18:02 -07:00
nixCats.url = "github:BirdeeHub/nixCats-nvim";
2024-10-09 17:13:16 -07:00
2024-10-10 00:21:39 -07:00
plugins-typst-preview = {
url = "github:chomosuke/typst-preview.nvim";
flake = false;
};
plugins-lsp-progress = {
url = "github:linrongbin16/lsp-progress.nvim";
flake = false;
};
2024-10-09 17:13:16 -07:00
};
outputs =
{
self,
nixpkgs,
nixCats,
...
}@inputs:
let
inherit (nixCats) utils;
luaPath = "${./.}";
forEachSystem = utils.eachSystem nixpkgs.lib.platforms.all;
extra_pkg_config = {
# allowUnfree = true;
};
inherit
(forEachSystem (
system:
let
2024-10-10 01:14:12 -07:00
dependencyOverlays = (import ./nix/overlays.nix) ++ [
# This overlay grabs all the inputs named in the format
# `plugins-<pluginName>`
# Once we add this overlay to our nixpkgs, we are able to
# use `pkgs.neovimPlugins`, which is a set of our plugins.
(utils.standardPluginOverlay inputs)
# add any flake overlays here.
];
2024-10-09 17:13:16 -07:00
in
# these overlays will be wrapped with ${system}
# and we will call the same utils.eachSystem function
# later on to access them.
{
inherit dependencyOverlays;
}
))
dependencyOverlays
;
# see :help nixCats.flake.outputs.categories
# and
# :help nixCats.flake.outputs.categoryDefinitions.scheme
categoryDefinitions =
{
pkgs,
settings,
categories,
name,
...
}@packageDef:
{
2024-10-10 01:14:12 -07:00
# lspsAndRuntimeDeps: this section is for dependencies that should be
# available at RUN TIME for plugins. Will be available to PATH within
# neovim terminal this includes LSPs
2024-10-09 17:13:16 -07:00
lspsAndRuntimeDeps = {
general = with pkgs; [
2024-10-10 00:21:39 -07:00
# essential
2024-10-09 17:13:16 -07:00
ripgrep
python312Packages.pylatexenc
2024-10-10 00:21:39 -07:00
fd
# lsps (minimal because should be provided per-project by nix)
2024-10-10 00:21:39 -07:00
nixd
tinymist
# formatters
2024-10-10 00:21:39 -07:00
nixfmt-rfc-style
2024-10-10 00:49:25 -07:00
nodePackages_latest.prettier
taplo
typstyle
rustfmt
black
stylua
2024-10-10 01:14:12 -07:00
marksman
2024-10-09 17:13:16 -07:00
];
};
2024-10-10 00:21:39 -07:00
# install lz.n and treesitter grammars
2024-10-09 17:13:16 -07:00
startupPlugins = {
gitPlugins = with pkgs.neovimPlugins; [ ];
general = with pkgs.vimPlugins; [
lz-n
(nvim-treesitter.withPlugins (
p:
(with p; [
lua
c
javascript
typescript
rust
haskell
typst
latex
nix
json
toml
yaml
markdown
2024-10-10 00:21:39 -07:00
markdown_inline
2024-10-09 17:13:16 -07:00
svelte
css
html
vim
bash
make
2024-10-10 00:49:25 -07:00
gitcommit
2024-10-29 20:08:26 -07:00
jsonc
2024-10-09 17:13:16 -07:00
])
))
];
};
2024-10-10 00:21:39 -07:00
# plugins which are installed, but not loaded, and will be handled by
# lz.n (not necessarily lazy loaded)
2024-10-09 17:13:16 -07:00
optionalPlugins = {
gitPlugins = with pkgs.neovimPlugins; [
2024-10-10 00:21:39 -07:00
typst-preview
lsp-progress
2024-10-09 17:13:16 -07:00
];
general = with pkgs.vimPlugins; [
nvim-autopairs
nvim-lspconfig
2024-10-10 00:21:39 -07:00
which-key-nvim
telescope-nvim
markdown-preview-nvim
render-markdown-nvim
rose-pine
nvim-web-devicons
oil-nvim
telescope-ui-select-nvim
harpoon2
toggleterm-nvim
trouble-nvim
lualine-nvim
mini-ai
2024-10-10 00:49:25 -07:00
mini-hipatterns
2024-10-10 00:21:39 -07:00
mini-surround
mini-notify
mini-starter
mini-trailspace
cellular-automaton-nvim
indent-blankline-nvim
mini-bufremove
neogit
gitsigns-nvim
diffview-nvim
barbecue-nvim
2024-10-10 00:49:25 -07:00
undotree
conform-nvim
2024-10-10 13:52:42 -07:00
neocord
rustaceanvim
crates-nvim
haskell-tools-nvim
2024-10-11 12:28:29 -07:00
vim-wakatime
2024-10-11 12:51:01 -07:00
lsp_lines-nvim
vim-sleuth
2024-10-17 01:03:43 -07:00
typescript-tools-nvim
texpresso-vim
blink-cmp
2024-11-20 11:04:58 -08:00
clangd_extensions-nvim
2024-10-09 17:13:16 -07:00
];
};
# shared libraries to be added to LD_LIBRARY_PATH
# variable available to nvim runtime
sharedLibraries = {
general = with pkgs; [
# libgit2
];
};
};
packageDefinitions = {
nvim =
{ pkgs, ... }:
{
settings = {
wrapRc = true;
aliases = [
"vim"
"vi"
];
};
categories = {
general = true;
gitPlugins = true;
customPlugins = true;
2024-10-10 00:21:39 -07:00
bin = {
websocat = "${pkgs.websocat}/bin/websocat";
tinymist = "${pkgs.tinymist}/bin/tinymist";
texpresso = "${pkgs.texpresso}/bin/texpresso";
2024-10-09 17:13:16 -07:00
};
2024-10-12 17:41:56 -07:00
nixdExtras = {
nixpkgs = inputs.nixpkgs.outPath;
flake-path = inputs.self.outPath;
system = pkgs.system;
};
2024-10-09 17:13:16 -07:00
};
};
};
defaultPackageName = "nvim";
in
forEachSystem (
system:
let
nixCatsBuilder = utils.baseBuilder luaPath {
inherit
nixpkgs
system
dependencyOverlays
extra_pkg_config
;
} categoryDefinitions packageDefinitions;
defaultPackage = nixCatsBuilder defaultPackageName;
pkgs = import nixpkgs { inherit system; };
in
{
packages = utils.mkAllWithDefault defaultPackage;
devShells = {
default = pkgs.mkShell {
name = defaultPackageName;
packages = [ defaultPackage ] ++ (with pkgs; [ lua-language-server ]);
2024-10-09 17:13:16 -07:00
};
};
}
)
// {
overlays = utils.makeOverlays luaPath {
inherit nixpkgs dependencyOverlays extra_pkg_config;
} categoryDefinitions packageDefinitions defaultPackageName;
nixosModules.default = utils.mkNixosModules {
inherit
defaultPackageName
dependencyOverlays
luaPath
categoryDefinitions
packageDefinitions
extra_pkg_config
nixpkgs
;
};
homeModule = utils.mkHomeModules {
inherit
defaultPackageName
dependencyOverlays
luaPath
categoryDefinitions
packageDefinitions
extra_pkg_config
nixpkgs
;
};
inherit utils;
inherit (utils) templates;
};
}