1
0

feat: initial commit; NixOS Era

This commit is contained in:
2025-11-20 22:13:05 +01:00
commit 8d0bddf680
46 changed files with 2044 additions and 0 deletions

View File

@@ -0,0 +1 @@
vim.lsp.enable('fish_ls')

View File

@@ -0,0 +1,2 @@
vim.wo.wrap = false
vim.opt.expandtab = true

23
pkgs/neovim/default.nix Normal file
View File

@@ -0,0 +1,23 @@
{
pkg ? import <nixpkg>,
lib ? pkg.lib,
...
}:
pkg.stdenv.mkDerivation rec {
pname = "neovim-config";
version = "1.0";
src = builtins.path {
path = ./.;
name = "neovim-config";
};
installPhase = ''
mkdir -p $out
cp -r ${src}/* $out/
'';
dontUnpack = true;
dontBuild = true;
}

14
pkgs/neovim/init.lua Normal file
View File

@@ -0,0 +1,14 @@
local lazy = require('BluePlum.lazy').bootstrap()
require('BluePlum')
if lazy then
lazy.setup({
spec = {
{ import = 'plugins' },
},
checker = { enabled = false },
change_detection = { notify = false },
performance = { rtp = { reset = false } }
})
end

View File

@@ -0,0 +1,20 @@
{
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
"cord.nvim": { "branch": "master", "commit": "a4484bb25e343a375d95b250ffadbdcbfbfdf2ac" },
"flash.nvim": { "branch": "develop", "commit": "045457978f3fb7df03efa2023dbc8a5f6e9179bd" },
"formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
"markview.nvim": { "branch": "main", "commit": "d5d37102d24c3d5d032b01263855081b6850509b" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" },
"nvim-treesitter": { "branch": "main", "commit": "dafb3cb3cb066774526c1103f3d1d6b34578800b" },
"oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" },
"oxocarbon.nvim": { "branch": "main", "commit": "acdfdd5d319c36170b5ad2a120283bec2f450081" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"smear-cursor.nvim": { "branch": "main", "commit": "4a0f7ac265b4ed1ce4d0af2afc13072763bfa691" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"vim-fugitive": { "branch": "master", "commit": "593f831d6f6d779cbabb70a4d1e6b1b1936a88af" }
}

View File

@@ -0,0 +1,4 @@
return {
cmd = { 'bash-language-server', 'start' },
filetypes = { 'sh', 'bash' },
}

View File

@@ -0,0 +1,4 @@
return {
cmd = { 'fish-lsp', 'start' },
filetypes = { 'fish' },
}

View File

@@ -0,0 +1,5 @@
return {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
root_markers = { '.luarc.json', '.luarc.jsonc' },
}

36
pkgs/neovim/lsp/nixd.lua Normal file
View File

@@ -0,0 +1,36 @@
return {
cmd = { 'nixd' },
filetypes = { 'nix' },
root_markers = { { 'configuration.nix', 'flake.nix', 'default.nix' } },
settings = {
nixd = {
options = {
nixos = {
expr = [[
(import <nixpkgs/nixos/lib/eval-config.nix> {
modules = [
<nixos-config>
/etc/nixos/hardware-configuration.nix
];
})
.options
]]
},
['home-manager'] = {
expr = [[
let
pkgs = import <nixpkgs> {};
config = pkgs.callPackage <nixos-config> {};
home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-${config.system.stateVersion}.tar.gz";
in
(import "${home-manager}/modules" {
inherit pkgs;
configuration = /etc/nixos/home.nix;
})
.options
]]
}
}
}
}
}

View File

@@ -0,0 +1,12 @@
return {
cmd = { 'rust-analyzer' },
filetypes = { 'rust' },
root_markers = { 'Cargo.toml', '.git' },
settings = {
['rust-analyzer'] = {
check = {
command = 'clippy',
},
},
},
}

View File

@@ -0,0 +1,5 @@
return {
cmd = { 'typescript-language-server', '--stdio' },
filetypes = { 'typescript', 'javascript' },
root_markers = { 'package.json', 'tsconfig.json' },
}

View File

@@ -0,0 +1,22 @@
vim.api.nvim_create_user_command('Dot', 'edit ~/.config/nvim', {})
vim.cmd.cnoreabbrev('Git', 'GIt')
vim.api.nvim_create_user_command('GIt', function(ctx)
local subcommand = ctx.fargs[1]
if subcommand == 'log' then
local argv = table.concat({
'log',
'--graph',
'--abbrev-commit',
'--decorate',
}, ' ')
local sliced = vim.list_slice(ctx.fargs, 2)
vim.cmd.Git(argv .. ' ' .. table.concat(sliced, ' '))
return
end
vim.cmd.Git(table.concat(ctx.fargs, ' '))
end, {
nargs = '+',
})

View File

@@ -0,0 +1,3 @@
require('BluePlum.set')
require('BluePlum.keymap')
require('BluePlum.commands')

View File

@@ -0,0 +1,87 @@
--- Defaults to `{'n'}`
--- @alias Mode 'n'|'v'|'Q'|'t'|'i'|'c'
--- @alias Mapping string|fun(): nil
--- @type table<string, { [string]: Mapping, modes: (Mode)[]? }>
local keymap = {
move_lines = {
['<M-Up>'] = '<ESC>:move-2<CR>i',
['<M-Down>'] = '<ESC>:move+<CR>i',
modes = { 'i' },
},
half_screen_scroll = {
['<C-Up>'] = '<C-u>zz',
['<C-Down>'] = '<C-d>zz',
},
clipboard_yank = {
['<leader>y'] = '"+y',
modes = { 'n', 'v' },
},
terminal_escape = {
['<ESC>'] = '<C-\\><C-n>',
modes = { 't' },
},
terminal = {
['<leader>t'] = function()
OpenTerminal = OpenTerminal or nil
local open_buf = vim.api.nvim_get_current_buf()
if PreviousBuffer and open_buf == OpenTerminal then
vim.api.nvim_set_current_buf(PreviousBuffer)
PreviousBuffer = nil
return
end
PreviousBuffer = open_buf
if OpenTerminal then
vim.api.nvim_set_current_buf(OpenTerminal)
return
end
vim.cmd.term()
OpenTerminal = vim.api.nvim_get_current_buf()
vim.api.nvim_create_autocmd({ 'BufDelete' }, {
callback = function()
OpenTerminal = nil
end,
buffer = OpenTerminal,
})
end,
},
goto_last_buffer = {
['<leader>l'] = ':e#<CR>',
},
scratch_pad = {
['<leader>s'] = table.concat({
':bo vs',
':enew',
':setlocal noswapfile',
':setlocal bufhidden=hide',
':set filetype=markdown',
':set syntax=markdown',
'',
}, '<CR>'),
},
window_navigation = {
['<M-q>'] = '<C-w>q',
['<M-left>'] = '<C-w><left>',
['<M-right>'] = '<C-w><right>',
['<M-up>'] = '<C-w><up>',
['<M-down>'] = '<C-w><down>',
},
}
for _, tbl in pairs(keymap) do
for key, value in pairs(tbl) do
if key ~= 'modes' then
local modes = tbl.modes --[[ @as Mode[] ]]
or { 'n' }
for _, mode in ipairs(modes) do
--- @cast value Mapping
vim.keymap.set(mode, key, value)
end
end
end
end

View File

@@ -0,0 +1,64 @@
--- @class Lazy
--- @field setup fun(opts: table)
local M = {}
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
--- @nodiscard
--- @return Lazy?
function M.bootstrap()
--- @type { fs_stat: fun(path: string): boolean }
local fs = vim.uv or vim.loop
if fs.fs_stat(lazypath) then
vim.opt.rtp:prepend(lazypath)
return require('lazy')
end
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
{ out, 'WarningMsg' },
}, true, {})
return nil
end
return require('lazy')
end
M.icons = 'echasnovski/mini.icons'
M.icons_require = function()
return require('mini.icons')
end
--- @enum PlenaryModule
local _ = {
async = 'async',
async_lib = 'async_lib',
job = 'job',
path = 'path',
scandir = 'scandir',
context_manager = 'context_manager',
test_harness = 'test_harness',
filetype = 'filetype',
strings = 'strings',
}
--- @param module PlenaryModule
M.plenary_require = function(module)
return require('plenary.' .. module)
end
M.plenary = 'nvim-lua/plenary.nvim'
--- @enum
M.event = {
BufEnter = 'BufEnter',
BufWinEnter = 'BufWinEnter',
BufWritePost = 'BufWritePost',
VeryLazy = 'VeryLazy',
}
return M

View File

@@ -0,0 +1,96 @@
local opts = {
mapleader = ' ',
linenr = {
number = true,
relativenumber = true,
cursorline = true,
cursorlineopt = 'number',
},
-- Use tabs for indents
indent = {
autoindent = true,
noexpandtab = true,
tabstop = 4,
shiftwidth = 4,
},
terminal = {
termguicolors = true,
shell = vim.env.SHELL or '/bin/sh',
},
split = {
splitright = true,
splitbelow = true,
},
search = {
hlsearch = false,
incsearch = true,
},
foldlevelstart = 99,
}
--- @param tbl table
local function apply(tbl)
for key, value in pairs(tbl) do
if type(value) == 'table' then
apply(value)
else
if vim.fn.exists('&' .. key) == 1 then
vim.opt[key] = value
else
vim.g[key] = value
end
end
end
end
apply(opts)
-- Tabs for indenting
-- vim.opt.autoindent = true
-- vim.g.noexpandtab = true
-- vim.opt.tabstop = 4
-- vim.opt.shiftwidth = 4
--
-- -- Line numbers
-- vim.opt.number = true
-- vim.opt.relativenumber = true
-- vim.opt.cursorline = true
-- vim.opt.cursorlineopt = 'number'
-- Folding
-- vim.opt.foldlevelstart = 99
-- vim.g.mapleader = ' '
-- Terminal
-- vim.g.termguicolors = true
-- vim.opt.shell = '/bin/fish'
-- LSP
-- vim.lsp.inlay_hint.enable()
-- Splitting
-- vim.opt.splitright = true
-- vim.opt.splitbelow = true
-- Make text readable
-- vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
-- pattern = { '*.md', '*.typ' },
-- command = 'setlocal linebreak',
-- })
-- vim.api.nvim_create_autocmd('FileType', {
-- pattern = 'help',
-- command = 'setlocal linebreak',
-- })
-- Search
-- vim.opt.hlsearch = false
-- vim.opt.incsearch = true

View File

@@ -0,0 +1,18 @@
return {
{
'vyfor/cord.nvim',
event = 'VeryLazy',
build = ':Cord update',
opts = {},
cond = vim.env.CORDLESS ~= 'true',
},
{
'tpope/vim-fugitive',
cmd = { 'Git' },
},
{
dir = '~/dev/share.nvim/',
opts = {},
enabled = false,
},
}

View File

@@ -0,0 +1,32 @@
local common = require('BluePlum.lazy')
return {
{ common.icons, opts = {} },
{
'folke/todo-comments.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = {},
event = common.event.BufWinEnter,
},
{
'OXY2DEV/markview.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter', common.icons },
ft = 'markdown',
opts = {
preview = {
icon_provider = 'mini',
},
},
},
{
'sphamba/smear-cursor.nvim',
opts = {
time_interval = 17,
anticipation = 0,
damping = 0.8,
cursor_color = '#b7bcb9',
legacy_computing_symbols_support = true,
},
},
}

View File

@@ -0,0 +1,81 @@
local common = require('BluePlum.lazy')
---@param exe string
---@param args { [number]: string, path: boolean? }
local function formatter(exe, args)
return {
function()
local argv = {}
for _, val in ipairs(args) do
table.insert(argv, val)
end
if args.path ~= false then
table.insert(argv, vim.fn.shellescape(vim.api.nvim_buf_get_name(0)))
end
return {
exe = exe,
args = argv,
stdin = true,
}
end,
}
end
local prettier = formatter('prettier', {
'--config-precedence prefer-file',
'--single-quote',
'--use-tabs',
'--trailing-comma es5',
'--bracket-same-line',
'--stdin-filepath',
})
return {
{
'mhartington/formatter.nvim',
event = common.event.BufWritePost,
opts = {
filetype = {
javascript = prettier,
typescript = prettier,
markdown = prettier,
css = prettier,
json = prettier,
html = prettier,
scss = prettier,
rust = formatter('rustfmt', { path = false }),
lua = formatter('stylua', {
'--indent-type Tabs',
'--line-endings Unix',
'--quote-style AutoPreferSingle',
'--column-width' .. ' ' .. vim.o.columns,
'-',
}),
nix = formatter('nixfmt', {
'--indent=4',
'--strict',
}),
['*'] = {
function()
if vim.lsp.buf.formatting then
vim.lsp.buf.format()
end
end,
},
},
},
config = function(lazy)
require('formatter').setup(lazy.opts)
vim.api.nvim_create_augroup('__formatter__', { clear = true })
vim.api.nvim_create_autocmd(common.event.BufWritePost, {
group = '__formatter__',
command = ':FormatWriteLock',
})
end,
},
}

View File

@@ -0,0 +1,87 @@
local common = require('BluePlum.lazy')
return {
-- Mason
{ 'mason-org/mason.nvim', opts = {} },
{
'mason-org/mason-lspconfig.nvim',
version = '1.*',
config = function(lazy)
local mason_lspconfig = require('mason-lspconfig')
mason_lspconfig.setup(lazy.opts)
mason_lspconfig.setup_handlers({
vim.lsp.enable
})
vim.lsp.enable('nixd')
vim.lsp.enable('rust_analyzer')
end,
dependencies = {
'mason-org/mason.nvim',
},
},
{
'Saghen/blink.cmp',
dependencies = { common.icons },
version = '1.*',
build = 'cargo build --release',
opts = {
keymap = {
preset = 'default',
['<Up>'] = { 'select_prev', 'fallback' },
['<Down>'] = { 'select_next', 'fallback' },
['<Tab>'] = { 'accept', 'fallback' },
},
appearance = {
nerd_font_variant = 'normal',
},
sources = {
default = { 'lsp', 'buffer', 'path', 'omni' },
},
completion = {
list = { selection = { auto_insert = false } },
documentation = {
auto_show = true,
auto_show_delay_ms = 700,
},
ghost_text = { enabled = true },
menu = {
auto_show = true,
draw = {
columns = { { 'kind_icon' }, { 'label', 'label_description', gap = 1 }, { 'kind' } },
components = {
kind_icon = {
text = function(ctx)
local icon, _, _ = common.icons_require().get('lsp', ctx.kind)
return icon
end,
},
kind = {
text = function(ctx)
return '(' .. ctx.kind .. ')'
end,
highlight = 'SpecialKey',
},
},
},
},
},
cmdline = {
enabled = true,
keymap = { preset = 'inherit' },
sources = { 'buffer', 'cmdline' },
completion = {
list = { selection = { preselect = true, auto_insert = false } },
ghost_text = { enabled = true },
menu = {
auto_show = true,
},
},
},
signature = { enabled = true, window = { show_documentation = true } },
},
},
}

View File

@@ -0,0 +1,50 @@
local common = require('BluePlum.lazy')
local telescope = {
find_files = function()
require('telescope.builtin').find_files({ show_hidden = true })
end,
live_grep = function()
require('telescope.builtin').live_grep()
end,
buffers = function()
require('telescope.builtin').buffers()
end,
}
return {
{
'nvim-telescope/telescope.nvim',
dependencies = { common.plenary },
keys = {
{ '<leader>ff', telescope.find_files },
{ '<leader>fs', telescope.live_grep },
{ '<leader>bb', telescope.buffers },
},
},
{
'stevearc/oil.nvim',
opts = {
default_file_explorer = true,
view_options = {
show_hidden = true,
},
},
lazy = false,
keys = {
{ '<leader>ex', vim.cmd.Oil },
},
},
{
'Kaiser-Yang/flash.nvim',
branch = 'develop',
event = common.event.VeryLazy,
opts = {
modes = {
char = {
multi_line = false,
},
},
},
},
}

View File

@@ -0,0 +1,43 @@
return {
{
'nyoom-engineering/oxocarbon.nvim',
priority = 999,
config = function()
vim.cmd.colorscheme('oxocarbon')
local groups = {
Text = 'Identifier',
Method = '@function.builtin',
Function = 'Function',
Constructor = '@character',
Field = '@property',
Variable = '@label',
Class = 'Todo',
Interface = 'Type',
Module = 'Macro',
Property = '@property',
Unit = 'Type',
Value = 'Number',
Enum = 'String',
Keyword = 'Identifier',
Snippet = 'Identifier',
Color = 'Identifier',
File = 'Identifier',
Folder = 'identifier',
Reference = 'Identifier',
EnumMember = 'String',
Constant = '@constant.builtin',
Struct = 'Type',
Event = '@constant',
Operator = 'Structure',
TypeParameter = 'Type',
}
for key, value in pairs(groups) do
vim.api.nvim_set_hl(0, 'BlinkCmpKind' .. key, { link = value })
end
vim.api.nvim_set_hl(0, 'BlinkCmpMenuSelection', { link = 'IncSearch' })
end,
},
}

View File

@@ -0,0 +1,19 @@
local common = require('BluePlum.lazy')
return {
{
'nvim-treesitter/nvim-treesitter',
branch = 'main',
event = common.event.VeryLazy,
build = ':TSUpdate',
opts = {
ensure_installed = { 'lua', 'markdown', 'typescript', 'javascript', 'rust', 'json', 'toml' },
highlight = {
enable = true,
},
auto_install = true,
},
},
}