This commit is contained in:
joygnu 2024-07-08 14:24:48 +02:00
parent dc39b85701
commit 007f05a82e
14 changed files with 348 additions and 24 deletions

View file

@ -1,4 +1,4 @@
{ config, pkgs, inputs, ... }:
{ inputs, ... }:
{
imports = [
@ -9,25 +9,10 @@
./gtk
./git
./ags
./neovim
./misc
inputs.ags.homeManagerModules.default
inputs.nixvim.homeManagerModules.nixvim
];
home.username = "joy";
home.homeDirectory = "/home/joy";
home.stateVersion = "23.11";
programs.home-manager.enable = true;
home.sessionVariables = {
EDITOR = "nvim";
};
qt.enable = true;
qt.style.name = "adwaita";
xdg.mimeApps.defaultApplications = {
"text/plain" = ["neovide.desktop"];
"image/*" = ["imv.desktop"];
"video/png" = ["mpv.desktop"];
"video/jpg" = ["mpv.desktop"];
"video/*" = ["mpv.desktop"];
};
}

22
home/misc/default.nix Normal file
View file

@ -0,0 +1,22 @@
{ config }:
{
home.username = "joy";
home.homeDirectory = "/home/joy";
home.stateVersion = "23.11";
programs.home-manager.enable = true;
home.sessionVariables = {
EDITOR = "nvim";
};
qt.enable = true;
qt.style.name = "adwaita";
xdg.mimeApps.defaultApplications = {
"text/plain" = ["neovide.desktop"];
"image/*" = ["imv.desktop"];
"video/png" = ["mpv.desktop"];
"video/jpg" = ["mpv.desktop"];
"video/*" = ["mpv.desktop"];
};
}

44
home/neovim/default.nix Normal file
View file

@ -0,0 +1,44 @@
{ ... }:
{
imports = [
./plugins
./set.nix
];
programs.nixvim = {
enable = true;
defaultEditor = true;
vimAlias = true;
clipboard.register = "unnamedplus";
colorschemes.gruvbox.enable = true;
plugins = {
presence-nvim = {
enable = true;
mainImage = "file";
};
bufferline = {
enable = true;
separatorStyle = "slope";
};
treesitter = {
enable = true;
indent = true;
nixvimInjections = true;
};
treesitter-context.enable = true;
nvim-tree = {
enable = true;
renderer.groupEmpty = true;
};
# lualine.enable = true;
};
keymaps = [
{
mode = "n";
key = "<C-n>";
action = "<cmd>NvimTreeToggle<CR>";
}
];
};
}

View file

@ -0,0 +1,78 @@
{ ... }:
{
programs.nixvim.plugins.alpha = {
enable = true;
layout = [
{
type = "padding";
val = 4;
}
{
opts = {
hl = "AlphaHeader";
position = "center";
};
type = "text";
val = [
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" git@github.com:TomJuri "
];
}
{
type = "padding";
val = 2;
}
{
type = "group";
val = let
mkButton = shortcut: cmd: val: hl: {
type = "button";
inherit val;
opts = {
inherit hl shortcut;
keymap = [
"n"
shortcut
cmd
{}
];
position = "center";
cursor = 0;
width = 40;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
};
in [
(
mkButton
"f"
"<CMD>lua require('telescope.builtin').find_files({hidden = true})<CR>"
"🔍 Find File"
"Operator"
)
(
mkButton
"q"
"<CMD>qa<CR>"
"💣 Quit"
"String"
)
];
}
{
type = "padding";
val = 2;
}
];
};
}

View file

@ -0,0 +1,81 @@
{ ... }:
{
programs.nixvim = {
plugins = {
cmp-nvim-lsp.enable = true;
cmp_luasnip.enable = true;
cmp = {
enable = true;
settings = {
autoEnableSources = true;
experimental = { ghost_text = true; };
performance = {
debounce = 57;
fetchingTimeout = 197;
maxViewEntries = 27;
};
snippet.expand = ''
function(args)
require('luasnip').lsp_expand(args.body)
end
'';
formatting.fields = ["kind" "abbr" "menu"];
sources = [
{
name = "nvim_lsp";
}
{
name = "luasnip";
}
];
mapping = {
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()";
"<C-j>" = "cmp.mapping.select_next_item()";
"<C-k>" = "cmp.mapping.select_prev_item()";
};
window = {
completion.border = "solid";
documentation.border = "solid";
};
};
};
};
extraConfigLua = ''
luasnip = require("luasnip")
kind_icons = {
Text = "󰊄",
Method = "",
Function = "󰡱",
Constructor = "",
Field = "",
Variable = "󱀍",
Class = "",
Interface = "",
Module = "󰕳",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
'';
};
}

View file

@ -0,0 +1,10 @@
{ ... }:
{
imports = [
./alpha.nix
./cmp.nix
./lsp.nix
./luasnip.nix
./telescope.nix
];
}

View file

@ -0,0 +1,12 @@
{ ... }:
{
programs.nixvim.plugins.lsp = {
enable = true;
servers = {
nil-ls = { enable = true; };
kotlin-language-server = { enable = true; };
rust-analyzer = { enable = true; installCargo = true; installRustc = true; };
pyright = { enable = true; };
};
};
}

View file

@ -0,0 +1,16 @@
{ pkgs, ... }:
{
programs.nixvim.plugins.luasnip = {
enable = true;
extraConfig = {
enable_autosnippets = true;
store_selection_keys = "<Tab>";
};
fromVscode = [
{
lazyLoad = true;
paths = "${pkgs.vimPlugins.friendly-snippets}";
}
];
};
}

View file

@ -0,0 +1,48 @@
{ pkgs, ... }:
{
home.packages = [
pkgs.ripgrep
];
programs.nixvim.plugins.telescope = {
enable = true;
extensions = {
file-browser = {
enable = true;
};
fzf-native = {
enable = true;
};
};
settings = {
defaults = {
layout_config = {
horizontal = {
prompt_position = "top";
};
};
sorting_strategy = "ascending";
};
};
keymaps = {
"<leader><space>" = {
action = "find_files, {}";
options = {
desc = "Find project files";
};
};
"<leader>/" = {
action = "live_grep";
options = {
desc = "Grep (root dir)";
};
};
"<C-p>" = {
action = "git_files, {}";
options = {
desc = "Search git files";
};
};
};
};
}

28
home/neovim/set.nix Normal file
View file

@ -0,0 +1,28 @@
{ ... }:
{
programs.nixvim = {
globals.mapleader = " ";
opts = {
number = true;
relativenumber = true;
tabstop = 2;
softtabstop = 2;
showtabline = 2;
expandtab = true;
shiftwidth = 2;
smartindent = true;
breakindent = true;
cursorline = true;
scrolloff = 8;
cmdheight = 0;
wrap = true;
termguicolors = true;
colorcolumn = "150";
showmode = false;
};
};
}

View file

@ -24,6 +24,7 @@
em = "nvim ~/nix/modules/misc/default.nix";
es = "nvim ~/nix/modules/stylix/default.nix";
ep = "nvim ~/nix/modules/packages/default.nix";
ev = "nvim ~/nix/home/neovim/default.nix";
};
history.size = 10000;

View file

@ -7,6 +7,5 @@
./misc
./gdm
./stylix
./neovim
];
}

View file

@ -23,10 +23,10 @@ programs.gnupg.agent = {
enableSSHSupport = true;
};
programs.neovim = {
enable = true;
defaultEditor = true;
};
#programs.neovim = {
# enable = true;
# defaultEditor = true;
#};
programs.hyprland.enable = true;
users.defaultUserShell = pkgs.zsh;

View file

@ -10,7 +10,7 @@
defaultEditor = true;
vimAlias = true;
clipboard.register = "unnamedplus";
colorschemes.catppuccin.enable = true;
colorschemes.gruvbox.enable = true;
plugins = {
presence-nvim = {