sets up basic structure

This commit is contained in:
Dennis 2026-03-03 13:46:54 +01:00
parent a0e3d792a9
commit 2ac5d0321b
17 changed files with 1368 additions and 36 deletions

View file

@ -1,12 +1,30 @@
{
description = "dnsc IaC config utilizing, Nix (flakes), NixOS, Nix Darwin and flake-parts";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts = {
inputs.nixpkgs-lib.follows = "nixpkgs-lib";
url = "github:hercules-ci/flake-parts";
};
home-manager = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/home-manager";
};
import-tree.url = "github:vic/import-tree";
flake-file.url = "github:vic/flake-file";
nix-darwin = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:LnL7/nix-darwin/master";
};
nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
nixpkgs-lib.follows = "nixpkgs";
nixvim.url = "github:nix-community/nixvim";
};
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);
outputs =
inputs:
inputs.flake-parts.lib.mkFlake {
inherit inputs;
systems = [
"aarch64-darwin"
"x86_64-linux"
];
} (inputs.import-tree ./modules);
}

20
modules/config.nix Normal file
View file

@ -0,0 +1,20 @@
{ lib, ... }:
{
options.flake.globalConfig = {
username = lib.mkOption {
type = lib.types.str;
default = "dennis";
description = "Primary username for the system";
};
fullname = lib.mkOption {
type = lib.types.str;
default = "Dennis Schoepf";
description = "Full Name of the user";
};
email = lib.mkOption {
type = lib.types.str;
default = "me@dnsc.io";
description = "Full Name of the user";
};
};
}

View file

@ -0,0 +1,36 @@
{
inputs,
config,
...
}:
let
username = config.flake.globalConfig.username;
in
{
flake.darwinConfigurations.dnsc-air = inputs.nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = { inherit inputs; };
modules = [
inputs.home-manager.darwinModules.home-manager
{
networking.hostName = "dnsc-air";
networking.computerName = "dnsc-air";
users.users.${username}.home = "/Users/${username}";
nix.enable = false;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
home-manager = {
useGlobalPkgs = true;
backupFileExtension = "backup";
users.${username} = {
imports = [ config.flake.modules.homeManager.neovim ];
home.stateVersion = "24.11";
};
};
}
];
};
}

View file

@ -0,0 +1,16 @@
{ ... }:
{
flake.modules.homeManager.neovim-colorscheme = {
programs.nixvim = {
colorscheme = "winterly";
# Make palette available to this module but
# also for other configuration (e.g. lualine)
extraFiles."lua/dnsc/palette.lua".source = ./extraFiles/palette.lua;
# Set custorscheme in neovims runtimepath so that neovim
# discovers it automatically
extraFiles."colors/winterly.lua".source = ./extraFiles/winterly.lua;
};
};
}

View file

@ -0,0 +1,32 @@
{ ... }:
{
flake.modules.homeManager.neovim-completion = {
programs.nixvim.plugins.blink-cmp = {
enable = true;
settings = {
keymap = {
preset = "enter";
"<Tab>" = [
"select_next"
"fallback"
];
"<S-Tab>" = [
"select_prev"
"fallback"
];
"<C-y>" = [
"select_and_accept"
];
"<C-k>" = [
"show_documentation"
"hide_documentation"
];
};
appearance.nerd_font_variant = "mono";
completion.documentation.auto_show = false;
signature.enabled = true;
cmdline.completion.menu.auto_show = true;
};
};
};
}

View file

@ -1,34 +1,17 @@
{
inputs,
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.neovim;
in
{
options.neovim = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable neovim";
};
extraPackages = mkOption {
type = types.listOf types.package;
default = [ ];
description = "Additional packages to install alongside neovim on the system.";
};
};
flake-file.inputs.nixvim.url = "github:nix-community/nixvim";
flake.modules.homeManager.neovim = {
imports = [ inputs.nixvim.homeModules.nixvim ];
programs.nixvim = {
enable = cfg.enable;
enable = true;
defaultEditor = true;
package = pkgs.neovim-unwrapped;
vimAlias = true;
vimdiffAlias = true;
};
};
}

View file

@ -0,0 +1,82 @@
{ pkgs, ... }:
{
flake.modules.homeManager.neovim-editing = {
programs.nixvim = {
plugins.sleuth.enable = true;
plugins.nvim-surround.enable = true;
plugins.flash.enable = true;
plugins.blink-pairs = {
enable = true;
};
plugins.treesitter = {
enable = true;
highlight.enable = true;
indent.enable = true;
folding.enable = true;
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
angular
bash
css
html
javascript
jsdoc
json
lua
make
markdown
markdown_inline
go
gomod
gotmpl
python
styled
tsx
typescript
nix
regex
toml
vim
vimdoc
xml
yaml
];
};
plugins.substitute = {
enable = true;
luaConfig.post = /* lua */ ''
local sub = require("substitute")
vim.keymap.set("n", "s", sub.operator, { noremap = true })
vim.keymap.set("n", "ss", sub.line, { noremap = true })
vim.keymap.set("n", "S", sub.eol, { noremap = true })
vim.keymap.set("x", "s", sub.visual, { noremap = true })
'';
};
extraPlugins = [
pkgs.vimPlugins.vim-cool
];
autoCmd = [
{
callback.__raw = "function() vim.highlight.on_yank() end";
event = [
"TextYankPost"
];
}
{
event = [ "FileType" ];
pattern = "qf";
callback.__raw = /* lua */ ''
function()
vim.keymap.set("n", "<CR>", "<CR>", { buffer = true })
end
'';
}
];
};
};
}

View file

@ -0,0 +1,33 @@
return {
fg = "#ffffff",
fg_alt = "#bf8a9f",
fg_dim = "#807c9f",
bg = "#0f0b15",
bg_secondary = "#1d202f",
grey = "#807c9f",
grey_bright = "#807c9f",
red = "#f47359",
red_bright = "#ff6a7a",
red_subtle_bg = "#67182f",
green = "#29a444",
green_bright = "#00a392",
green_subtle_bg = "#10452f",
yellow = "#b58a52",
yellow_bright = "#df9080",
yellow_brighter = "#FCC1B6",
yellow_subtle_bg = "#54362a",
blue = "#3f95f6",
blue_bright = "#029fff",
blue_subtle_bg = "#2a346e",
blue_subtle_dark_bg = "#003045",
magenta = "#d369af",
magenta_bright = "#af85ea",
magenta_brighter = "#c57faf",
magenta_subtle_bg = "#572454",
magenta_subtle_bg_darker = "#331531",
cyan = "#4fbaef",
cyan_bright = "#35afbf",
cyan_subtle_bg = "#133d56",
silver = "#b8c6d5",
silver_bright = "#ffffff",
}

View file

@ -0,0 +1,368 @@
local palette = require("dnsc.palette")
vim.cmd.highlight("clear")
vim.g.colors_name = "winterly"
local hi = function(name, val)
-- Force links
val.force = true
-- Make sure that `cterm` attribute is not populated from `gui`
val.cterm = val.cterm or {} ---@type vim.api.keyset.highlight
-- Define global highlight
vim.api.nvim_set_hl(0, name, val)
end
-- General
hi("Normal", { fg = palette.fg })
hi("Conceal", { fg = palette.silver, bg = palette.grey, ctermfg = "LightGrey", ctermbg = "DarkGrey" })
hi("Cursor", { bg = palette.magenta_bright })
hi("DiffText", { bg = palette.yellow_subtle_bg, bold = true, ctermbg = "DarkYellow", cterm = { bold = true } })
hi("ErrorMsg", { fg = palette.red_bright, bg = palette.red_subtle_bg, ctermfg = "White", ctermbg = "DarkRed" })
hi("IncSearch", { bg = palette.magenta_subtle_bg, fg = palette.magenta })
hi("ModeMsg", { bold = true, cterm = { bold = true } })
hi("NonText", { fg = palette.grey, ctermfg = "DarkGrey" })
hi("PmenuSbar", { bg = palette.grey, ctermbg = "Grey" })
hi("StatusLine", { reverse = true, bold = true, cterm = { reverse = true, bold = true } })
hi("StatusLineNC", { reverse = true, cterm = { reverse = true } })
hi("TabLineFill", { reverse = true, cterm = { reverse = true } })
hi("TabLineSel", { bold = true, cterm = { bold = true } })
hi("TermCursor", { reverse = true, cterm = { reverse = true } })
hi("WinBar", { bold = true, cterm = { bold = true } })
hi("WildMenu", { fg = palette.bg, bg = palette.yellow_subtle_bg, ctermfg = "Black", ctermbg = "Yellow" })
hi("VertSplit", { link = "Comment" })
hi("WinSeparator", { link = "VertSplit" })
hi("WinBarNC", { link = "WinBar" })
hi("DiffTextAdd", { link = "DiffText" })
hi("EndOfBuffer", { link = "NonText" })
hi("LineNrAbove", { link = "LineNr" })
hi("LineNrBelow", { link = "LineNr" })
hi("QuickFixLine", { link = "Search" })
hi("CursorLineSign", { link = "SignColumn" })
hi("CursorLineFold", { link = "FoldColumn" })
hi("CurSearch", { link = "Search" })
hi("PmenuKind", { link = "Pmenu" })
hi("PmenuKindSel", { link = "PmenuSel" })
hi("PmenuMatch", { link = "Pmenu" })
hi("PmenuMatchSel", { link = "PmenuSel" })
hi("PmenuExtra", { link = "Pmenu" })
hi("PmenuExtraSel", { link = "PmenuSel" })
hi("PreInsert", { link = "Added" })
hi("ComplMatchIns", {})
hi("ComplHint", { link = "NonText" })
hi("ComplHintMore", { link = "MoreMsg" })
hi("Whitespace", { link = "NonText" })
hi("MsgSeparator", { link = "StatusLine" })
hi("NormalFloat", { link = "Pmenu" })
hi("FloatBorder", { bg = palette.bg_secondary, fg = palette.fg_dim })
hi("FloatTitle", { bg = palette.bg_secondary, fg = palette.fg, bold = true })
hi("FloatFooter", { link = "Title" })
hi("FloatShadow", { bg = palette.bg, blend = 80 })
hi("FloatShadowThrough", { bg = palette.bg, blend = 100 })
hi("RedrawDebugNormal", { reverse = true, cterm = { reverse = true } })
hi("RedrawDebugClear", { bg = palette.yellow_subtle_bg, ctermbg = "DarkYellow" })
hi("RedrawDebugComposed", { bg = palette.green_subtle_bg, ctermbg = "DarkGreen" })
hi("RedrawDebugRecompose", { bg = palette.red_subtle_bg, ctermbg = "DarkRed" })
hi("Error", { link = "ErrorMsg" })
hi("NvimInternalError", { link = "ErrorMsg" })
hi("Todo", { fg = palette.blue_bright, bg = palette.blue_subtle_bg, ctermbg = "DarkBlue", ctermfg = "LightBlue" })
hi("String", { link = "Constant" })
hi("Character", { link = "Constant" })
hi("Number", { link = "Boolean" })
hi("Boolean", { fg = palette.magenta_bright, bold = true })
hi("Float", { link = "Number" })
hi("Function", { link = "Identifier" })
hi("Conditional", { link = "Statement" })
hi("Repeat", { link = "Statement" })
hi("Label", { link = "Statement" })
hi("Operator", { fg = palette.fg_alt, italic = false, ctermfg = "White" })
hi("Keyword", { link = "Statement" })
hi("Exception", { link = "Statement" })
hi("Include", { link = "PreProc" })
hi("Define", { link = "PreProc" })
hi("Macro", { link = "PreProc" })
hi("PreCondit", { link = "PreProc" })
hi("StorageClass", { link = "Type" })
hi("Structure", { link = "Type" })
hi("Typedef", { bold = true, fg = palette.yellow_brighter, ctermfg = "LightYellow" })
hi("Tag", { link = "Special" })
hi("SpecialChar", { link = "Special" })
hi("Delimiter", { link = "Special" })
hi("SpecialComment", { link = "Special" })
hi("Debug", { link = "Special" })
hi("DiagnosticError", { fg = palette.red_bright, ctermfg = 1 })
hi("DiagnosticWarn", { fg = palette.yellow, ctermfg = 3 })
hi("DiagnosticInfo", { fg = palette.cyan, ctermfg = 4 })
hi("DiagnosticHint", { fg = palette.silver, ctermfg = 7 })
hi("DiagnosticOk", { fg = palette.green_bright, ctermfg = 10 })
hi("DiagnosticUnderlineError", { fg = palette.red_bright, undercurl = true, cterm = { underline = true } })
hi("DiagnosticUnderlineWarn", { fg = palette.yellow, undercurl = true, cterm = { underline = true } })
hi("DiagnosticUnderlineInfo", { fg = palette.cyan, undercurl = true, cterm = { underline = true } })
hi("DiagnosticUnderlineHint", { fg = palette.silver, undercurl = true, cterm = { underline = true } })
hi("DiagnosticUnderlineOk", { fg = palette.green_bright, undercurl = true, cterm = { underline = true } })
hi("DiagnosticVirtualTextError", { link = "DiagnosticError" })
hi("DiagnosticVirtualTextWarn", { link = "DiagnosticWarn" })
hi("DiagnosticVirtualTextInfo", { link = "DiagnosticInfo" })
hi("DiagnosticVirtualTextHint", { link = "DiagnosticHint" })
hi("DiagnosticVirtualTextOk", { link = "DiagnosticOk" })
hi("DiagnosticFloatingError", { link = "DiagnosticError" })
hi("DiagnosticFloatingWarn", { link = "DiagnosticWarn" })
hi("DiagnosticFloatingInfo", { link = "DiagnosticInfo" })
hi("DiagnosticFloatingHint", { link = "DiagnosticHint" })
hi("DiagnosticFloatingOk", { link = "DiagnosticOk" })
hi("DiagnosticSignError", { link = "DiagnosticError" })
hi("DiagnosticSignWarn", { link = "DiagnosticWarn" })
hi("DiagnosticSignInfo", { link = "DiagnosticInfo" })
hi("DiagnosticSignHint", { link = "DiagnosticHint" })
hi("DiagnosticSignOk", { link = "DiagnosticOk" })
hi("DiagnosticDeprecated", { fg = palette.red, strikethrough = true, cterm = { strikethrough = true } })
hi("DiagnosticUnnecessary", { link = "Unused" })
hi("LspInlayHint", { link = "NonText" })
hi("SnippetTabstop", { link = "Visual" })
hi("SnippetTabstopActive", { link = "SnippetTabstop" })
-- Text
hi("@markup.raw", { link = "Special" })
hi("@markup.link", { link = "Identifier" })
hi("@markup.link.label", { link = "ConstantUnderlined" })
hi("@markup.heading", { link = "Title" })
hi("@markup.heading.gitcommit", { bg = palette.bg, fg = palette.fg, bold = true })
hi("@markup.link.url", { link = "Underlined" })
hi("@markup.underline", { link = "Underlined" })
hi("@comment.todo", { link = "Todo" })
-- Miscs
hi("@comment", { link = "Comment" })
hi("@punctuation", { link = "Delimiter" })
-- Constants
hi("@constant", { link = "Constant" })
hi("@constant.builtin", { link = "Special" })
hi("@constant.macro", { link = "Define" })
hi("@keyword.directive", { link = "Define" })
hi("@string", { link = "String" })
hi("@string.escape", { link = "SpecialChar" })
hi("@string.special", { link = "SpecialChar" })
hi("@character", { link = "Character" })
hi("@character.special", { link = "SpecialChar" })
hi("@number", { link = "Number" })
hi("@boolean", { link = "Boolean" })
hi("@number.float", { link = "Float" })
-- Functions
hi("@function", { link = "Function" })
hi("@function.builtin", { link = "Special" })
hi("@function.macro", { link = "Macro" })
hi("@function.method", { link = "Function" })
hi("@variable.parameter", { link = "Identifier" })
hi("@variable.parameter.builtin", { link = "Special" })
hi("@variable.member", { link = "Identifier" })
hi("@property", { link = "Identifier" })
hi("@attribute", { link = "Macro" })
hi("@attribute.builtin", { link = "Special" })
hi("@constructor", { link = "Special" })
-- Keywords
hi("@keyword.conditional", { link = "Conditional" })
hi("@keyword.repeat", { link = "Repeat" })
hi("@keyword.type", { link = "Structure" })
hi("@label", { link = "Label" })
hi("@operator", { link = "Operator" })
hi("@keyword", { link = "Keyword" })
hi("@keyword.exception", { link = "Exception" })
hi("@variable", { link = "Identifier" })
hi("@type", { link = "Type" })
hi("@type.builtin", { link = "Type" })
hi("@type.definition", { link = "Typedef" })
hi("@module", { link = "Identifier" })
hi("@keyword.import", { link = "Include" })
hi("@keyword.directive", { link = "PreProc" })
hi("@keyword.debug", { link = "Debug" })
hi("@tag", { link = "Tag" })
hi("@tag.tsx", { link = "Identifier" })
hi("@tag.builtin", { link = "Special" })
-- LSP semantic tokens
hi("@lsp.type.class", { link = "Structure" })
hi("@lsp.type.comment", { link = "Comment" })
hi("@lsp.type.decorator", { link = "Function" })
hi("@lsp.type.enum", { link = "Structure" })
hi("@lsp.type.enumMember", { link = "Constant" })
hi("@lsp.type.function", { link = "Function" })
hi("@lsp.type.interface", { link = "Structure" })
hi("@lsp.type.macro", { link = "Macro" })
hi("@lsp.type.method", { link = "Function" })
hi("@lsp.type.namespace", { link = "Structure" })
hi("@lsp.type.parameter", { link = "Identifier" })
hi("@lsp.type.property", { link = "Identifier" })
hi("@lsp.type.struct", { link = "Structure" })
hi("@lsp.type.type", { link = "Type" })
hi("@lsp.type.typeParameter", { link = "TypeDef" })
hi("@lsp.type.variable", { link = "Identifier" })
hi("@lsp.typemod.keyword.documentation", { fg = palette.grey, bold = true })
if vim.o.background == "light" then
-- TODO: Define light scheme
else
-- Default colors only used with a dark background.
hi("ColorColumn", { bg = palette.red_subtle_bg, ctermbg = "DarkRed" })
hi("CursorColumn", { bg = palette.grey, ctermbg = "DarkGrey" })
hi("CursorLine", { bg = palette.magenta_subtle_bg_darker, cterm = { underline = true } })
hi("CursorLineNr", {
fg = palette.fg,
bg = palette.magenta_subtle_bg_darker,
bold = true,
ctermfg = "White",
cterm = { underline = true },
})
hi("DiffAdd", { fg = palette.green_bright, bg = palette.green_subtle_bg, ctermbg = "DarkGreen" })
hi("DiffChange", { fg = palette.yellow_brighter, bg = palette.yellow_subtle_bg, ctermbg = "DarkYellow" })
hi("DiffDelete", { fg = palette.red_bright, bg = palette.red_subtle_bg, ctermbg = "DarkRed" })
hi("Directory", { fg = palette.magenta, bold = true, ctermfg = "Magenta" })
hi("FoldColumn", { fg = palette.cyan_bright, bg = palette.grey, ctermfg = "Cyan", ctermbg = "DarkGrey" })
hi("Folded", { fg = palette.cyan_bright, bg = palette.grey, ctermfg = "Cyan", ctermbg = "DarkGrey" })
hi("LineNr", { fg = palette.grey_bright, ctermfg = "Grey" })
hi(
"MatchParen",
{ fg = palette.fg_alt, bg = palette.magenta_subtle_bg, ctermbg = "DarkMagenta", ctermfg = "Black" }
)
hi("MoreMsg", { fg = palette.grey, ctermfg = "DarkGrey" })
hi("Pmenu", { bg = palette.bg_secondary, ctermfg = "White", ctermbg = "Black" })
hi("PmenuSel", {
bg = palette.magenta_subtle_bg,
fg = palette.fg,
bold = true,
ctermfg = "LightMagenta",
ctermbg = "DarkMagenta",
})
hi("PmenuThumb", { bg = palette.fg, ctermbg = "White" })
hi("Question", { fg = palette.green_bright, bold = true, ctermfg = "LightGreen" })
hi("Search", { link = "IncSearch" })
hi("Substitute", {
fg = palette.green_bright,
bg = palette.green_subtle_bg,
bold = true,
ctermfg = "DarkBlue",
ctermbg = "LightBlue",
})
hi("SignColumn", { fg = palette.grey_bright, bg = palette.bg, ctermfg = "Cyan", ctermbg = "DarkGrey" })
hi("SpecialKey", { fg = palette.cyan_bright, ctermfg = "LightBlue" })
hi("SpellBad", { fg = palette.red, undercurl = true, ctermbg = "Red" })
hi("SpellCap", { fg = palette.blue, undercurl = true, ctermbg = "Blue" })
hi("SpellLocal", { fg = palette.cyan, undercurl = true, ctermbg = "Cyan" })
hi("SpellRare", { fg = palette.magenta, undercurl = true, ctermbg = "Magenta" })
hi("StatusLineTerm", {
fg = palette.bg,
bg = palette.green_bright,
bold = true,
ctermfg = "Black",
ctermbg = "LightGreen",
cterm = { bold = true },
})
hi("StatusLineTermNC", { fg = palette.bg, bg = palette.green_bright, ctermfg = "Black", ctermbg = "LightGreen" })
hi(
"TabLine",
{ bg = palette.grey, underline = true, ctermfg = "White", ctermbg = "DarkGrey", cterm = { underline = true } }
)
hi("Title", { fg = palette.magenta_bright, bold = true, ctermfg = "Magenta" })
hi("Visual", {
fg = palette.magenta_brighter,
bg = palette.magenta_subtle_bg,
ctermfg = "LightMagenta",
ctermbg = "DarkMagenta",
})
hi("WarningMsg", { fg = palette.red_bright, ctermfg = "LightRed" })
hi("Comment", { fg = palette.grey, ctermfg = "Cyan" })
hi("Unused", { fg = palette.grey_bright, undercurl = true, ctermfg = "LightGrey" })
hi("Constant", { fg = palette.yellow_brighter, ctermfg = "LightYellow" })
hi("ConstantUnderlined", { fg = palette.yellow_brighter, underline = true, ctermfg = "LightYellow" })
hi("Special", { fg = palette.silver, ctermfg = "LightGrey" })
hi("Identifier", { fg = palette.fg, ctermfg = "White", cterm = { bold = true } })
hi("Statement", { fg = palette.fg_alt, bold = true, ctermfg = "White" })
hi("PreProc", { fg = palette.magenta, ctermfg = "LightMagenta" })
hi("Type", { fg = palette.silver, bold = true, ctermfg = "LightCyan" })
hi("Underlined", { fg = palette.silver, underline = true, ctermfg = "LightGrey", cterm = { underline = true } })
hi("Ignore", { fg = palette.bg, ctermfg = "Black" })
hi(
"Added",
{ fg = palette.green_bright, bg = palette.green_subtle_bg, ctermfg = "LightGreen", ctermbg = "DarkGreen" }
)
hi(
"Changed",
{ fg = palette.blue_bright, bg = palette.blue_subtle_bg, ctermfg = "LightBlue", ctermbg = "DarkBlue" }
)
hi("Removed", { fg = palette.red_bright, bg = palette.red_subtle_bg, ctermfg = "LightRed", ctermbg = "DarkRed" })
hi("NotificationInfo", { fg = palette.silver, bg = palette.bg, ctermfg = "White", ctermbg = "Black" })
-- Snacks
hi("SnacksIndentScope", { fg = palette.magenta, ctermfg = "LightGrey" })
hi("SnacksIndent", { fg = palette.magenta_subtle_bg, ctermfg = "DarkGrey" })
hi(
"SnacksPickerCursorLine",
{ bg = palette.magenta_subtle_bg, fg = palette.fg, bold = true, cterm = { underline = true } }
)
hi("SnacksPickerListCursorLine", { link = "SnacksPickerCursorLine" })
hi("SnacksPickerTitle", { link = "FloatTitle" })
hi("SnacksBackdrop", { link = "Pmenu" })
-- Flash
hi("FlashMatch", { reverse = true })
hi("FlashLabel", { bg = palette.fg, fg = palette.bg })
-- FzfLua
hi("FzfLuaNormal", { link = "Pmenu" })
hi("FzfLuaBorder", { link = "Pmenu" })
hi("FzfLuaTitle", { link = "Pmenu" })
hi("FzfLuaBackdrop", { link = "Pmenu" })
hi("FzfLuaPreviewNormal", { link = "FzfLuaNormal" })
hi("FzfLuaPreviewBorder", { link = "FzfLuaBorder" })
hi("FzfLuaPreviewTitle", { link = "FzfLuaTitle" })
hi(
"FzfLuaCursorLine",
{ bg = palette.magenta_subtle_bg, fg = palette.fg, bold = true, cterm = { underline = true } }
)
hi("FzfLuaTitleFlags", { link = "FzfLuaCursorLine" })
hi("FzfLuaCursorLineNr", { link = "FzfLuaCursorLine" })
hi("FzfLuaHeaderBind", { link = "Pmenu" })
hi("FzfLuaHeaderText", { link = "Comment" })
hi("FzfLuaPathLineNr", { link = "Pmenu" })
hi("FzfLuaPathColNr", { link = "Pmenu" })
hi("FzfLuaLivePrompt", { link = "Pmenu" })
hi("FzfLuaCmdBuf", { link = "Comment" })
hi("FzfLuaBufName", { link = "Pmenu" })
hi("FzfLuaBufId", { link = "Special" })
hi("FzfLuaBufLineNr", { link = "Special" })
hi("FzfLuaBufFlagCur", { link = "Pmenu" })
hi("FzfLuaBufFlagAlt", { link = "Comment" })
-- Blinkpairs
hi("BlinkPairsOrange", { link = "Comment" })
hi("BlinkPairsPurple", { fg = palette.magenta_brighter })
hi("BlinkPairsBlue", { fg = palette.magenta_bright })
-- Neogit
hi("NeogitDiffAdd", { link = "DiffAdd" })
hi("NeogitDiffDelete", { link = "DiffDelete" })
hi("NeogitDiffContext", { bg = palette.bg_secondary, fg = palette.fg })
hi("NeogitDiffContextCursor", { bg = palette.magenta_subtle_bg_darker, fg = palette.magenta_brighter })
hi("NeogitDiffAddCursor", { bg = palette.green_bright, fg = palette.green_subtle_bg })
hi("NeogitDiffDeleteCursor", { bg = palette.red_bright, fg = palette.red_subtle_bg })
hi("NeogitDiffContextHighlight", { link = "NeogitDiffContext" })
hi("NeogitDiffAddHighlight", { link = "DiffAdd" })
hi("NeogitDiffDeleteHighlight", { link = "DiffDelete" })
hi("NeogitHunkHeader", { bg = palette.bg_secondary, fg = palette.grey_bright })
hi("NeogitHunkMergeHeader", { link = "NeogitHunkHeader" })
hi("NeogitHunkHeaderHighlight", { bg = palette.magenta_subtle_bg, fg = palette.magenta_brighter })
hi("NeogitHunkHeaderCursor", { link = "NeogitHunkHeaderHighlight" })
hi("NeogitCommitViewHeader", { bg = palette.bg_secondary, fg = palette.fg })
hi("NeogitDiffHeader", { bg = palette.bg, fg = palette.grey_bright, bold = true })
hi("NeogitActiveItem", { bg = palette.grey_bright, fg = palette.bg, bold = true })
end

View file

@ -0,0 +1,57 @@
{ pkgs, ... }:
{
flake.modules.homeManager.neovim-formatter = {
programs.nixvim.plugins.conform-nvim = {
enable = true;
settings = {
formatters_by_ft = {
typescriptreact = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
astro = [ "prettierd" ];
typescript = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
javascript = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
javascriptreact = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
html = [ "prettierd" ];
htmlangular = [ "prettierd" ];
css = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
yaml = [ "prettierd" ];
markdown = [ "prettierd" ];
json = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
lua = [ "stylua" ];
go = [ "goimports" ];
gomod = [ "goimports" ];
gowork = [ "goimports" ];
gotmpl = [ "goimports" ];
};
format_on_save = {
timeout_ms = 500;
lsp_format = "fallback";
};
};
extraPackages = [ pkgs.stylua ];
};
};
}

33
modules/neovim/git.nix Normal file
View file

@ -0,0 +1,33 @@
{ ... }:
{
flake.modules.homeManager.neovim-git = {
programs.nixvim = {
plugins.gitportal = {
enable = true;
};
keymaps = [
{
key = "<leader>gll";
action = "<cmd>GitPortal<cr>";
options.desc = "Open line in Git provider";
}
{
key = "<leader>gll";
action = "<cmd>GitPortal<cr>";
options.desc = "Open line in Git provider";
}
{
key = "<leader>gly";
action = "<cmd>GitPortal copy_link_to_clipboard<cr>";
options.desc = "Copy link to line at Git provider";
}
{
key = "<leader>glo";
action = "<cmd>GitPortal open_link<cr>";
options.desc = "Open link to line at Git provider";
}
];
};
};
}

View file

@ -0,0 +1,134 @@
{ ... }:
{
flake.modules.homeManager.neovim-keybindings = {
programs.nixvim = {
plugins.which-key = {
enable = true;
icons.mappings = false;
};
keymaps = [
# Open
{
mode = [ "n" ];
key = "<leader>od";
action = "<cmd>vsplit | lua vim.lsp.buf.definition()<cr>";
options.desc = "Go to definition in other window";
}
# Buffer
{
mode = [ "n" ];
key = "<leader>bn";
action = "<cmd>bn<cr>";
options.desc = "Move to next buffer";
}
{
mode = [ "n" ];
key = "<leader>bp";
action = "<cmd>bp<cr>";
options.desc = "Move to previous buffer";
}
{
mode = [ "n" ];
key = "<leader>bk";
action = "<cmd>bn<cr>";
options.desc = "Kill buffer and window";
}
# File
{
mode = [ "n" ];
key = "<leader>fn";
action = "<cmd>enew<cr>";
options.desc = "Create a new file";
}
{
mode = [ "n" ];
key = "<leader>fs";
action = "<cmd>w<cr>";
options.desc = "Save currently opened file";
}
# Quit
{
mode = [ "n" ];
key = "<leader>qq";
action = "<cmd>qa!<cr>";
options.desc = "Leave neovim";
}
# Window
{
mode = [ "n" ];
key = "<leader>w+";
action = ":vertical resize +4<cr>";
options.desc = "Increase window size";
}
{
mode = [ "n" ];
key = "<leader>w-";
action = ":vertical resize -4<cr>";
options.desc = "Decrease window size";
}
{
mode = [ "n" ];
key = "<leader>wx";
action = ":bd<cr>";
options.desc = "Kill active window and buffer";
}
{
mode = [ "n" ];
key = "<leader>wh";
action = "<C-W>h";
options.desc = "Move to window on left";
}
{
mode = [ "n" ];
key = "<leader>wj";
action = "<C-W>j";
options.desc = "Move to window on bottom";
}
{
mode = [ "n" ];
key = "<leader>wk";
action = "<C-W>k";
options.desc = "Move to window on top";
}
{
mode = [ "n" ];
key = "<leader>wl";
action = "<C-W>l";
options.desc = "Move to window on right";
}
{
mode = [ "n" ];
key = "<leader>ws";
action = "<cmd>sp<cr>";
options.desc = "Split windows horizontally";
}
{
mode = [ "n" ];
key = "<leader>wv";
action = "<cmd>vsp<cr>";
options.desc = "Split windows vertically";
}
{
mode = [ "n" ];
key = "<leader>wd";
action = "<cmd>close<cr>";
options.desc = "Delete window only";
}
{
mode = [
"n"
"x"
"o"
];
key = "<CR>";
action.__raw = /* lua */ ''function() require("flash").jump() end'';
}
];
};
};
}

202
modules/neovim/lsp.nix Normal file
View file

@ -0,0 +1,202 @@
{ pkgs, ... }:
{
flake.modules.homeManager.neovim-lsp = {
programs.nixvim = {
plugins.lspconfig.enable = true;
lsp = {
enable = true;
servers = {
lua_ls = {
enable = true;
package = pkgs.lua-language-server;
packageFallback = true;
};
nil_ls = {
enable = true;
package = pkgs.nil;
packageFallback = true;
};
gopls = {
enable = true;
package = pkgs.gopls;
packageFallback = true;
};
ts_ls = {
enable = true;
package = pkgs.typescript-language-server;
packageFallback = true;
};
jsonls = {
enable = true;
package = pkgs.vscode-langservers-extracted;
packageFallback = true;
};
cssls = {
enable = true;
package = pkgs.vscode-langservers-extracted;
packageFallback = true;
};
html = {
enable = true;
package = pkgs.vscode-langservers-extracted;
packageFallback = true;
};
astro = {
enable = true;
package = pkgs.astro-language-server;
packageFallback = true;
config.init_options.typescript.tsdk = "${pkgs.typescript}/lib/node_modules/typescript/lib";
};
eslint = {
enable = true;
package = pkgs.vscode-langservers-extracted;
packageFallback = true;
config = {
root_markers = [
".eslintrc"
".eslintrc.js"
".eslintrc.cjs"
".eslintrc.yaml"
".eslintrc.yml"
".eslintrc.json"
"eslint.config.js"
"eslint.config.mjs"
"eslint.config.cjs"
"eslint.config.ts"
"eslint.config.mts"
"eslint.config.cts"
"package.json"
];
settings = {
validate = "on";
useESLintClass = false;
experimental = {
useFlatConfig = true;
};
codeActionOnSave = {
enable = false;
mode = "all";
};
format = true;
quiet = false;
onIgnoredFiles = "off";
rulesCustomizations = { };
run = "onType";
problems = {
shortenToSingleLine = false;
};
nodePath = "";
workingDirectory = {
mode = "location";
};
codeAction = {
disableRuleComment = {
enable = true;
location = "separateLine";
};
showDocumentation = {
enable = true;
};
};
};
handlers = {
"eslint/openDoc".__raw = /* lua */ ''
function(_, result)
if result then
vim.ui.open(result.url)
end
return {}
end
'';
"eslint/confirmESLintExecution" = /* lua */ ''
function(_, result)
if not result then
return
end
return 4 -- approved
end
'';
"eslint/probeFailed" = /* lua */ ''
function()
vim.notify("[lspconfig] ESLint probe failed.", vim.log.levels.WARN)
return {}
end
'';
"eslint/noLibrary" = /* lua */ ''
function()
vim.notify("[lspconfig] Unable to find ESLint library.", vim.log.levels.WARN)
return {}
end
'';
};
on_new_config.__raw = /* lua */ ''
function(config, new_root_dir)
-- This function is called when LSP attaches to a new buffer
-- Set the working directory to the root where eslint config is found
config.settings = config.settings or {}
config.settings.workspaceFolder = {
uri = new_root_dir,
name = vim.fn.fnamemodify(new_root_dir, ":t"),
}
-- Detect flat config
local flat_config_files = {
"eslint.config.js",
"eslint.config.mjs",
"eslint.config.cjs",
"eslint.config.ts",
"eslint.config.mts",
"eslint.config.cts",
}
for _, file in ipairs(flat_config_files) do
local config_path = new_root_dir .. "/" .. file
if vim.uv.fs_stat(config_path) then
config.settings.experimental = config.settings.experimental or {}
config.settings.experimental.useFlatConfig = true
break
end
end
-- Support Yarn PnP
local pnp_cjs = new_root_dir .. "/.pnp.cjs"
local pnp_js = new_root_dir .. "/.pnp.js"
if vim.uv.fs_stat(pnp_cjs) or vim.uv.fs_stat(pnp_js) then
config.cmd = vim.list_extend({ "yarn", "exec" }, config.cmd or {})
end
end
'';
};
};
biome = {
enable = true;
package = null;
packageFallback = false;
};
};
keymaps = [
{
key = "<leader>ca";
lspBufAction = "code_action";
}
{
key = "<leader>e";
action = "<cmd>lua vim.diagnostic.open_float()<cr>";
}
];
};
# Define diagnostic appearance
diagnostic.settings = {
virtual_text = false;
signs = true;
underline = true;
update_in_insert = false;
severity_sort = false;
};
};
};
}

View file

@ -0,0 +1,52 @@
{ ... }:
{
flake.modules.homeManager.neovim-options = {
programs.nixvim = {
globals = {
mapleader = " ";
maplocalleader = " ";
};
clipboard.register = "unnamedplus";
opts = {
backup = false;
cmdheight = 1;
conceallevel = 0;
fileencoding = "utf-8";
hlsearch = true;
ignorecase = true;
mouse = "a";
pumheight = 10;
showmode = false;
smartindent = true;
breakindent = true;
showtabline = 0;
smartcase = true;
splitbelow = true;
splitright = true;
swapfile = false;
termguicolors = true;
timeoutlen = 600;
undofile = true;
updatetime = 230;
writebackup = false;
expandtab = true;
shiftwidth = 2;
tabstop = 2;
cursorline = true;
number = true;
relativenumber = true;
numberwidth = 2;
signcolumn = "yes";
linebreak = true;
breakat = " ^I!@*-+;:,./?";
scrolloff = 4;
sidescrolloff = 4;
winbar = "";
foldlevel = 99;
foldlevelstart = 99;
};
};
};
}

174
modules/neovim/picker.nix Normal file
View file

@ -0,0 +1,174 @@
{ pkgs, ... }:
{
flake.modules.homeManager.neovim-picker = {
programs.nixvim = {
plugins.oil = {
enable = true;
settings = {
keymaps = {
"q" = "actions.close";
};
columns = [
"icon"
"permissions"
"size"
"mtime"
];
};
};
extraPlugins = [ pkgs.vimPlugins.snacks-nvim ];
extraConfigLua = /* lua */ ''
local Snacks = require("snacks");
local filter_lsp_definitions = function(item)
if item.file:match("/react/ts5.0/") or item.file:match("react.d.ts") then
return false
end
return true
end
Snacks.setup({
bigfile = { enabled = true },
bufdelete = { enabled = true },
git = { enabled = true },
indent = { enabled = true },
input = { enabled = true },
notifier = { enabled = true },
picker = {
enabled = true,
prompt = "λ ",
layout = { preset = "ivy" },
},
statuscolumn = { enabled = true },
})
'';
keymaps = [
# Git
{
key = "<leader>gb";
action.__raw = "function() Snacks.git.blame_line() end";
options.desc = "Show git blame for current line";
}
# Picker
{
key = "<leader>.";
action.__raw = "function() Snacks.picker.files({ hidden = true }) end";
options.desc = "Files";
}
{
key = "<leader><leader>";
action.__raw = "function() Snacks.picker.git_files() end";
options.desc = "Git files";
}
# Find
{
key = "<leader>fr";
action.__raw = "function() Snacks.picker.recent() end";
options.desc = "Recent";
}
{
key = "<leader>fp";
action.__raw = "function() Snacks.picker.projects() end";
options.desc = "Projects";
}
{
key = "<leader>bb";
action.__raw = "function() Snacks.picker.buffers() end";
options.desc = "List buffers";
}
{
key = "<leader>bd";
action.__raw = "function() Snacks.bufdelete() end";
options.desc = "Delete buffer";
}
{
key = "<leader>bD";
action.__raw = "function() Snacks.bufdelete.all() end";
options.desc = "Delete all buffers";
}
{
key = "<leader>bo";
action.__raw = "function() Snacks.bufdelete.other() end";
options.desc = "Delete other buffers";
}
# Search
{
key = "<leader>ss";
action.__raw = "function() Snacks.picker.grep() end";
options.desc = "Grep";
}
{
mode = [
"n"
"x"
];
key = "<leader>sw";
action.__raw = "function() Snacks.picker.grep_word() end";
options.desc = "Visual selection or word";
}
{
key = "<leader>su";
action.__raw = "function() Snacks.picker.undo() end";
options.desc = "Undo History";
}
# Diagnostics
{
key = "<leader>td";
action.__raw = "function() Snacks.picker.diagnostics_buffer() end";
options.desc = "Buffer Diagnostics";
}
{
key = "<leader>ta";
action.__raw = "function() Snacks.picker.diagnostics() end";
options.desc = "Diagnostics";
}
# LSP
{
key = "gd";
action.__raw = "function() Snacks.picker.lsp_definitions({ filter = { filter = filter_lsp_definitions } }) end";
options.desc = "Goto Definition";
}
{
key = "gD";
action.__raw = "function() Snacks.picker.lsp_declarations() end";
options.desc = "Goto Declaration";
}
{
key = "grr";
action.__raw = "function() Snacks.picker.lsp_references() end";
options = {
desc = "References";
nowait = true;
};
}
{
key = "gI";
action.__raw = "function() Snacks.picker.lsp_implementations() end";
options.desc = "Goto Implementation";
}
{
key = "gy";
action.__raw = "function() Snacks.picker.lsp_type_definitions() end";
options.desc = "Goto T[y]pe Definition";
}
# Notifications and highlights
{
key = "<leader>on";
action.__raw = "function() Snacks.notifier.show_history() end";
options.desc = "Open notification history";
}
{
key = "<leader>oh";
action.__raw = "function() Snacks.picker.highlights() end";
options.desc = "List highlights";
}
{
key = "<leader>n";
action = "<cmd>Oil<cr>";
options.desc = "Opens file explorer";
}
];
};
};
}

View file

@ -0,0 +1,99 @@
{ ... }:
{
flake.modules.homeManager.neovim-statusline = {
programs.nixvim.plugins.lualine = {
enable = true;
settings = {
options = {
theme = {
__raw = "winterly_lualine";
};
icons_enabled = false;
component_separators = {
left = "|";
right = "|";
};
section_separators = {
left = "";
right = "";
};
};
sections = {
lualine_a = [
{
__unkeyed-1 = "mode";
fmt = {
__raw = "function(str) return str:sub(1, 1) end";
};
}
];
lualine_b = [
{
__unkeyed-1 = "filename";
file_status = true;
newfile_status = false;
path = 4;
shorting_target = 120;
symbols = {
modified = "[+]";
readonly = "[-]";
unnamed = "[No Name]";
newfile = "[New]";
};
}
"encoding"
];
lualine_c = null;
lualine_x = null;
lualine_y = [
"branch"
"diff"
"diagnostics"
];
lualine_z = [
"location"
];
};
};
# Sets up my custom colorscheme
luaConfig.pre = /* lua */ ''
local palette = require("dnsc.palette")
local winterly_lualine = {
normal = {
a = { bg = palette.magenta, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.magenta },
c = { bg = palette.bg_secondary, fg = palette.magenta },
},
insert = {
a = { bg = palette.cyan_bright, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.cyan_bright },
c = { bg = palette.bg_secondary, fg = palette.cyan_bright },
},
visual = {
a = { bg = palette.blue_bright, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.blue_bright },
c = { bg = palette.bg_secondary, fg = palette.blue_bright },
},
replace = {
a = { bg = palette.red_bright, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.red_bright },
c = { bg = palette.bg_secondary, fg = palette.red_bright },
},
command = {
a = { bg = palette.green_bright, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.green_bright },
c = { bg = palette.bg_secondary, fg = palette.green_bright },
},
inactive = {
a = { bg = palette.bg_secondary, fg = palette.fg_dim },
b = { bg = palette.bg_secondary, fg = palette.fg_dim },
c = { bg = palette.bg_secondary, fg = palette.fg_dim },
},
}
'';
};
};
}

View file

@ -1,7 +0,0 @@
{
# Currently using ARM on MacOS and x86 on Linux
systems = [
"aarch64-darwin"
"x86_64-linux"
];
}