This commit is contained in:
joy 2024-07-08 13:44:01 +02:00
parent 036c9f863f
commit 27542ac09a
14 changed files with 588 additions and 16 deletions

View file

@ -132,7 +132,59 @@
"type": "github" "type": "github"
} }
}, },
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1717408969,
"narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=",
"owner": "numtide",
"repo": "devshell",
"rev": "1ebbe68d57457c8cae98145410b164b5477761f4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_3": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1673956053, "lastModified": 1673956053,
@ -148,6 +200,45 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1719877454,
"narHash": "sha256-g5N1yyOSsPNiOlFfkuI/wcUjmtah+nxdImJqrSATjOU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "4e3583423212f9303aa1a6337f8dffb415920e4f",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"fromYaml": { "fromYaml": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -164,6 +255,55 @@
"type": "github" "type": "github"
} }
}, },
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1719259945,
"narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"nixvim",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gnome-shell": { "gnome-shell": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -202,6 +342,27 @@
} }
}, },
"home-manager_2": { "home-manager_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1719827439,
"narHash": "sha256-tneHOIv1lEavZ0vQ+rgz67LPNCgOZVByYki3OkSshFU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "59ce796b2563e19821361abbe2067c3bb4143a7d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_3": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"stylix", "stylix",
@ -222,6 +383,27 @@
"type": "github" "type": "github"
} }
}, },
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1719845423,
"narHash": "sha256-ZLHDmWAsHQQKnmfyhYSHJDlt8Wfjv6SQhl2qek42O7A=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "ec12b88104d6c117871fad55e931addac4626756",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1718714799, "lastModified": 1718714799,
@ -270,11 +452,39 @@
"type": "github" "type": "github"
} }
}, },
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"git-hooks": "git-hooks",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": [
"nixpkgs"
],
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1720367057,
"narHash": "sha256-ZdSDmunn2oDPWm19RlFTwlK9BoAi9uw9QliWE4FnQc4=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "a6cc4c6c331c86e6b1ff7316fdc076f4ca7b163b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"ags": "ags", "ags": "ags",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"nixvim": "nixvim",
"stylix": "stylix" "stylix": "stylix"
} }
}, },
@ -287,9 +497,9 @@
"base16-kitty": "base16-kitty", "base16-kitty": "base16-kitty",
"base16-tmux": "base16-tmux", "base16-tmux": "base16-tmux",
"base16-vim": "base16-vim", "base16-vim": "base16-vim",
"flake-compat": "flake-compat", "flake-compat": "flake-compat_3",
"gnome-shell": "gnome-shell", "gnome-shell": "gnome-shell",
"home-manager": "home-manager_2", "home-manager": "home-manager_3",
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
@ -305,6 +515,42 @@
"repo": "stylix", "repo": "stylix",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1719887753,
"narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -6,10 +6,15 @@
ags.url = "github:Aylur/ags"; ags.url = "github:Aylur/ags";
stylix.url = "github:danth/stylix"; stylix.url = "github:danth/stylix";
home-manager = { nixvim = {
url = "github:nix-community/home-manager"; url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
@ -25,6 +30,7 @@
specialArgs = {inherit inputs;}; specialArgs = {inherit inputs;};
modules = [ modules = [
./hosts/laptop ./hosts/laptop
inputs.stylix.nixosModules.stylix
]; ];
}; };
}; };

View file

@ -2,14 +2,15 @@
{ {
imports = [ imports = [
./rofi ./rofi
./alacritty ./alacritty
./hyprland ./hyprland
./zsh ./zsh
./gtk ./gtk
./git ./git
./ags ./ags
inputs.ags.homeManagerModules.default inputs.ags.homeManagerModules.default
inputs.nixvim.homeManagerModules.nixvim
]; ];
home.username = "joy"; home.username = "joy";

View file

@ -34,8 +34,6 @@
exec-once = [ exec-once = [
"lxqt-policykit-agent &" "lxqt-policykit-agent &"
"swww init &"
"swww img ~/nix/home/hyprland/wallpaper.png &"
"ags -c ~/nix/home/ags/config.js &" "ags -c ~/nix/home/ags/config.js &"
"wl-paste --type text --watch cliphist store" "wl-paste --type text --watch cliphist store"
"wl-paste --type image --watch cliphist store" "wl-paste --type image --watch cliphist store"

View file

@ -10,5 +10,6 @@
../../modules ../../modules
./hardware.nix ./hardware.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
# nixvim.nixosModules.nixvim
]; ];
} }

View file

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

View file

@ -0,0 +1,46 @@
{ ... }:
{
home-manager.users.joy = {
imports = [
./plugins
./set.nix
];
programs.nixvim = {
enable = true;
defaultEditor = true;
vimAlias = true;
clipboard.register = "unnamedplus";
colorschemes.catppuccin.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
modules/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;
};
};
}