Merge branch 'new' of ssh://git.0x76.dev:42/v/infrastructure into new
Some checks failed
Lint / lint (push) Has been cancelled

This commit is contained in:
Vivian 2024-11-30 15:53:31 +01:00
commit 0d2d9f5be5
6 changed files with 418 additions and 407 deletions

View file

@ -38,7 +38,7 @@ in
}; };
programs.kitty = { programs.kitty = {
theme = "Catppuccin-Frappe"; themeFile = "Catppuccin-Frappe";
font.name = "DejaVuSansMono Nerd Font"; font.name = "DejaVuSansMono Nerd Font";
}; };

View file

@ -6,15 +6,6 @@
}: }:
let let
cfg = config.programs.v.nvim; cfg = config.programs.v.nvim;
nvim-nio = pkgs.vimUtils.buildVimPlugin {
name = "nvim-nio";
src = pkgs.fetchFromGitHub {
owner = "nvim-neotest";
repo = "nvim-nio";
rev = "refs/tags/v1.8.0";
sha256 = "sha256-RFmH+683vrg4BELwtAQqjV8oGkvRgzcd6kd5r1s3Jp8=";
};
};
in in
with lib; with lib;
{ {
@ -24,12 +15,25 @@ with lib;
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ fd ]; home.packages = with pkgs; [ fd ];
home.file.".config/nvim/lua".source = ./lua; home.file.".config/nvim/lua".source = ./lua;
programs.nixvim = {helpers, ...}: { programs.nixvim =
{ helpers, ... }:
{
enable = true; enable = true;
imports = [
./keybinds.nix
./lsp.nix
];
package = pkgs.neovim-unwrapped; package = pkgs.neovim-unwrapped;
vimAlias = true; vimAlias = true;
luaLoader.enable = true; luaLoader.enable = true;
performance = {
byteCompileLua.enable = true;
combinePlugins.enable = true;
};
globals.mapleader = " "; globals.mapleader = " ";
opts = { opts = {
@ -44,155 +48,11 @@ with lib;
clipboard.providers.wl-copy.enable = true; clipboard.providers.wl-copy.enable = true;
keymaps = with helpers; [
# General
{
mode = "n";
key = "<leader>";
action = ":noh<CR>";
}
# Telescope
{
mode = "n";
key = "<leader>ff";
action = ":Telescope find_files<CR>";
}
{
mode = "n";
key = "<leader>fs";
action = ":Telescope file_browser<CR>";
}
{
mode = "n";
key = "<leader>fg";
action = mkRaw "require('telescope.builtin').live_grep";
}
{
mode = "n";
key = "<leader>fb";
action = ":Telescope buffers<CR>";
}
{
mode = "n";
key = "<leader>fo";
action = ":Telescope oldfiles<CR>";
}
{
mode = "n";
key = "<leader>fr";
action = ":Telescope frecency<CR>";
}
{
mode = "n";
key = "<leader>ob";
action = mkRaw "require('obsidian_picker').obsidian_picker";
}
# Commenting
{
mode = "n";
key = "<C-/>";
action = mkRaw "require('Comment.api').toggle.linewise.current";
}
{
mode = "x";
key = "<C-/>";
action = mkRaw ''
function()
local esc = vim.api.nvim_replace_termcodes(
'<ESC>', true, false, true
)
vim.api.nvim_feedkeys(esc, 'nx', false)
require('Comment.api').toggle.linewise(vim.fn.visualmode())
end
'';
}
# Float Term
{
mode = "n";
key = "t";
action = ":FloatermToggle myfloat<CR>";
}
{
mode = "t";
key = "<ESC>";
action = mkRaw "function() vim.cmd(':FloatermToggle myfloat') end";
}
# Switch buffers
{
mode = "n";
key = "<leader>q";
action = ":bd<CR>"; # Delete buffer
}
{
mode = "n";
key = "<leader>s";
action = ":bn<CR>"; # Buffer next
}
{
mode = "n";
key = "<leader>a";
action = ":bp<CR>"; # Buffer previous
}
# Change Indenting
{
mode = "n";
key = "<S-Tab>";
action = "<<_";
}
{
mode = "n";
key = "<Tab>";
action = ">>_";
}
{
mode = "v";
key = "<Tab>";
action = ">gv";
}
{
mode = "v";
key = "<S-Tab>";
action = "<gv";
}
# Neotest
{
mode = "n";
key = "<leader>nr";
action = mkRaw "require('neotest').run.run";
}
{
mode = "n";
key = "<leader>no";
action = mkRaw "require('neotest').output.open";
}
{
mode = "n";
key = "<leader>ns";
action = mkRaw "require('neotest').run.stop";
}
{
mode = "n";
key = "<leader>nf";
action = mkRaw "function() require('neotest').run.run(vim.fn.expand('%')) end";
}
# LSP
{
mode = "n";
key = "<M-CR>";
action = ":Lspsaga code_action<CR>";
}
];
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
FixCursorHold-nvim FixCursorHold-nvim
nvim-web-devicons
nvim-nio
nvim-surround
]; ];
extraConfigLua = " extraConfigLua = "";
require('nvim-surround').setup()
";
colorschemes.catppuccin = { colorschemes.catppuccin = {
enable = true; enable = true;
@ -200,12 +60,9 @@ with lib;
}; };
plugins = { plugins = {
dap = { nvim-surround.enable = true;
enable = true; dap.enable = true;
}; image.enable = true;
image = {
enable = true;
};
web-devicons.enable = true; web-devicons.enable = true;
bufferline.enable = true; bufferline.enable = true;
nix.enable = true; nix.enable = true;
@ -234,24 +91,24 @@ with lib;
nvim_cmp = true; nvim_cmp = true;
}; };
picker.name = "telescope.nvim"; picker.name = "telescope.nvim";
note_id_func = '' # note_id_func = ''
function(title) # function(title)
-- Create note IDs in a Zettelkasten format with a timestamp and a suffix. # -- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
-- In this case a note with the title 'My new note' will be given an ID that looks # -- In this case a note with the title 'My new note' will be given an ID that looks
-- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md' # -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
local suffix = "" # local suffix = ""
if title ~= nil then # if title ~= nil then
-- If title is given, transform it into valid file name. # -- If title is given, transform it into valid file name.
suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() # suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
else # else
-- If title is nil, just add 4 random uppercase letters to the suffix. # -- If title is nil, just add 4 random uppercase letters to the suffix.
for _ = 1, 4 do # for _ = 1, 4 do
suffix = suffix .. string.char(math.random(65, 90)) # suffix = suffix .. string.char(math.random(65, 90))
end # end
end # end
return tostring(os.time()) .. "-" .. suffix # return tostring(os.time()) .. "-" .. suffix
end # end
''; # '';
}; };
}; };
fidget = { fidget = {
@ -281,9 +138,9 @@ with lib;
nixGrammars = true; nixGrammars = true;
settings.highlight.enable = true; settings.highlight.enable = true;
}; };
# surround.enable = true;
fugitive.enable = true; fugitive.enable = true;
# gitgutter.enable = true; committia.enable = true;
lualine = { lualine = {
enable = true; enable = true;
@ -305,74 +162,6 @@ with lib;
extensions.frecency.enable = true; extensions.frecency.enable = true;
}; };
comment.enable = true; comment.enable = true;
none-ls = {
enable = true;
sources = {
formatting = {
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
};
};
};
lsp = {
enable = true;
keymaps = {
lspBuf = {
K = "hover";
gD = "references";
gd = "definition";
gi = "implementation";
gt = "type_definition";
"g=" = "format";
};
diagnostic = {
"<leader>j" = "goto_next";
"<leader>k" = "goto_prev";
};
};
servers = {
cssls.enable = true;
nil_ls.enable = true; #NixOS
dockerls.enable = true;
rust_analyzer = {
enable = true;
installCargo = false;
installRustc = false;
};
pyright.enable = true;
pylsp = {
enable = true;
settings.plugins = {
black = {
enabled = true;
cache_config = true;
};
pycodestyle = {
maxLineLength = 100;
};
};
};
elixirls.enable = true;
clangd.enable = true;
yamlls.enable = true;
lua_ls.enable = true;
};
};
trouble.enable = true;
lspkind.enable = true;
lspsaga = {
enable = true;
lightbulb.enable = false;
};
nvim-lightbulb = {
enable = true;
settings = {
autocmd.enabled = true;
number.enabled = true;
};
};
vimtex.enable = true; vimtex.enable = true;
floaterm.enable = true; floaterm.enable = true;
cmp = { cmp = {

View file

@ -0,0 +1,146 @@
{ helpers, ... }:
{
keymaps = with helpers; [
# General
{
mode = "n";
key = "<leader>";
action = ":noh<CR>";
}
# Telescope
{
mode = "n";
key = "<leader>ff";
action = ":Telescope find_files<CR>";
}
{
mode = "n";
key = "<leader>fs";
action = ":Telescope file_browser<CR>";
}
{
mode = "n";
key = "<leader>fg";
action = mkRaw "require('telescope.builtin').live_grep";
}
{
mode = "n";
key = "<leader>fb";
action = ":Telescope buffers<CR>";
}
{
mode = "n";
key = "<leader>fo";
action = ":Telescope oldfiles<CR>";
}
{
mode = "n";
key = "<leader>fr";
action = ":Telescope frecency<CR>";
}
{
mode = "n";
key = "<leader>ob";
action = mkRaw "require('obsidian_picker').obsidian_picker";
}
# Commenting
{
mode = "n";
key = "<C-/>";
action = mkRaw "require('Comment.api').toggle.linewise.current";
}
{
mode = "x";
key = "<C-/>";
action = mkRaw ''
function()
local esc = vim.api.nvim_replace_termcodes(
'<ESC>', true, false, true
)
vim.api.nvim_feedkeys(esc, 'nx', false)
require('Comment.api').toggle.linewise(vim.fn.visualmode())
end
'';
}
# Float Term
{
mode = "n";
key = "t";
action = ":FloatermToggle myfloat<CR>";
}
{
mode = "t";
key = "<ESC>";
action = mkRaw "function() vim.cmd(':FloatermToggle myfloat') end";
}
# Switch buffers
{
mode = "n";
key = "<leader>q";
action = ":bd<CR>"; # Delete buffer
}
{
mode = "n";
key = "<leader>s";
action = ":bn<CR>"; # Buffer next
}
{
mode = "n";
key = "<leader>a";
action = ":bp<CR>"; # Buffer previous
}
# Change Indenting
{
mode = "i";
key = "<S-Tab>";
action = "<C-o><<";
}
{
mode = "n";
key = "<S-Tab>";
action = "<<_";
}
{
mode = "n";
key = "<Tab>";
action = ">>_";
}
{
mode = "v";
key = "<Tab>";
action = ">gv";
}
{
mode = "v";
key = "<S-Tab>";
action = "<gv";
}
# Neotest
{
mode = "n";
key = "<leader>nr";
action = mkRaw "require('neotest').run.run";
}
{
mode = "n";
key = "<leader>no";
action = mkRaw "require('neotest').output.open";
}
{
mode = "n";
key = "<leader>ns";
action = mkRaw "require('neotest').run.stop";
}
{
mode = "n";
key = "<leader>nf";
action = mkRaw "function() require('neotest').run.run(vim.fn.expand('%')) end";
}
# LSP
{
mode = "n";
key = "<M-CR>";
action = ":Lspsaga code_action<CR>";
}
];
}

View file

@ -0,0 +1,76 @@
{ pkgs, ... }:
{
plugins = {
lsp = {
enable = true;
keymaps = {
lspBuf = {
K = "hover";
gD = "references";
gd = "definition";
gi = "implementation";
gt = "type_definition";
"<leader>rn" = "rename";
"g=" = "format";
};
diagnostic = {
"<leader>j" = "goto_next";
"<leader>k" = "goto_prev";
};
};
servers = {
cssls.enable = true;
nil_ls.enable = true; # NixOS
dockerls.enable = true;
rust_analyzer = {
enable = true;
installCargo = false;
installRustc = false;
};
pyright.enable = true;
pylsp = {
enable = true;
settings.plugins = {
black = {
enabled = true;
cache_config = true;
};
pycodestyle = {
maxLineLength = 100;
};
};
};
elixirls.enable = true;
clangd.enable = true;
yamlls.enable = true;
lua_ls.enable = true;
};
};
trouble.enable = true;
lspkind.enable = true;
lspsaga = {
enable = true;
lightbulb.enable = false;
};
nvim-lightbulb = {
enable = true;
settings = {
autocmd.enabled = true;
number.enabled = true;
};
};
none-ls = {
enable = true;
sources = {
formatting = {
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
};
};
};
};
}

80
flake.lock generated
View file

@ -58,11 +58,11 @@
}, },
"catppuccin": { "catppuccin": {
"locked": { "locked": {
"lastModified": 1731232837, "lastModified": 1732838231,
"narHash": "sha256-0aIwr/RC/oe7rYkfJb47xjdEQDSNcqpFGsEa+EPlDEs=", "narHash": "sha256-KJTRqfEcGpONBK/6BkMdWmbGth0r/nYWY3k/rvZl4es=",
"owner": "catppuccin", "owner": "catppuccin",
"repo": "nix", "repo": "nix",
"rev": "32359bf226fe874d3b7a0a5753d291a4da9616fe", "rev": "becc64812c8d6af24dedc2f75c5c63ebf778a115",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -625,11 +625,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732420764, "lastModified": 1732884235,
"narHash": "sha256-u6JOOVlnGe8fMekW0BgaHuuZwbJp4ixQaMA5BEvRoDA=", "narHash": "sha256-r8j6R3nrvwbT1aUp4EPQ1KC7gm0pu9VcV1aNaB+XG6Q=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "67cd4814a247fd0fe97171acb90659f7e304bcb8", "rev": "819f682269f4e002884702b87e445c82840c68f2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -646,11 +646,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732303962, "lastModified": 1732482255,
"narHash": "sha256-5Umjb5AdtxV5jSJd5jxoCckh5mlg+FBQDsyAilu637g=", "narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "8cf9cb2ee78aa129e5b8220135a511a2be254c0c", "rev": "a9953635d7f34e7358d5189751110f87e3ac17da",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -742,11 +742,11 @@
"spectrum": "spectrum" "spectrum": "spectrum"
}, },
"locked": { "locked": {
"lastModified": 1732122592, "lastModified": 1732633513,
"narHash": "sha256-lF54irx92m8ddNDQDtOUjKsZAnsGyPL3QTO7byjlxNg=", "narHash": "sha256-6LmtOmeDpv9iHS8l0GNcppP11dKIJFMZLdFyxQ+qQBM=",
"owner": "astro", "owner": "astro",
"repo": "microvm.nix", "repo": "microvm.nix",
"rev": "19650774c23df84d0b8f315d2527274563497cad", "rev": "093ef734d3c37669860043a87dbf1c09fc6f5b38",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -763,11 +763,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732324260, "lastModified": 1732603785,
"narHash": "sha256-0xzQvoId/P008QkTSAdFVv465P9rL9nYkIOWXL5pdsY=", "narHash": "sha256-AEjWTJwOmSnVYsSJCojKgoguGfFfwel6z/6ud6UFMU8=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "698a62c628c2ec423aa770d8ec0e1d0bcf4fca1a", "rev": "6ab87b7c84d4ee873e937108c4ff80c015a40c7a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -820,11 +820,11 @@
}, },
"nixlib": { "nixlib": {
"locked": { "locked": {
"lastModified": 1731805462, "lastModified": 1732410305,
"narHash": "sha256-yhEMW4MBi+IAyEJyiKbnFvY1uARyMKJpLUhkczI49wk=", "narHash": "sha256-/hxIKRTBsdrnudJWDGaBN8wIjHovqVAVxXdi8ByVtck=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs.lib", "repo": "nixpkgs.lib",
"rev": "b9f04e3cf71c23bea21d2768051e6b3068d44734", "rev": "87b6978992e2eb605732fba842cad0a7e14b2047",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -841,11 +841,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732151224, "lastModified": 1732496924,
"narHash": "sha256-5IgpueM8SGLOadzUJK6Gk37zEBXGd56BkNOtoWmnZos=", "narHash": "sha256-/MNhZLR0eh9z/d3l+ammq+F5XxHln0RHgO4Bhtjr0IM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixos-generators", "repo": "nixos-generators",
"rev": "3280fdde8c8f0276c9f5286ad5c0f433dfa5d56c", "rev": "098e8b6ff72c86944a8d54b64ddd7b7e6635830a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -856,11 +856,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1731797098, "lastModified": 1732483221,
"narHash": "sha256-UhWmEZhwJZmVZ1jfHZFzCg+ZLO9Tb/v3Y6LC0UNyeTo=", "narHash": "sha256-kF6rDeCshoCgmQz+7uiuPdREVFuzhIorGOoPXMalL2U=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "672ac2ac86f7dff2f6f3406405bddecf960e0db6", "rev": "45348ad6fb8ac0e8415f6e5e96efe47dd7f39405",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -966,26 +966,26 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1731755305, "lastModified": 1732521221,
"narHash": "sha256-v5P3dk5JdiT+4x69ZaB18B8+Rcu3TIOrcdG4uEX7WZ8=", "narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "057f63b6dc1a2c67301286152eb5af20747a9cb4", "rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-24.11", "ref": "nixos-unstable",
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_5": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1732014248, "lastModified": 1732521221,
"narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", "narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", "rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1024,11 +1024,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1732365274, "lastModified": 1732838896,
"narHash": "sha256-78n1Z3+i686w1FHCWEiEimxvwJF/sgtG7Px0RyI9bLE=", "narHash": "sha256-9YfEyCU2wB/aSbtpZ+OHb++xS2Km970Ja33H13oEaWM=",
"owner": "pta2002", "owner": "pta2002",
"repo": "nixvim", "repo": "nixvim",
"rev": "85759f2360faa0464da008b040217183d99fd9d9", "rev": "05331006a42846d6e55129b642485f45f90c9efc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1039,11 +1039,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1732438268, "lastModified": 1732877422,
"narHash": "sha256-5bhAbn8h2jv3HzlyaZ6nSypOlBLkfbbjXVsYueGSmvE=", "narHash": "sha256-ZDOlikQLTOnKek5J2bHItv0tWS6c1kdcLzVMseGd2rI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "5347bd2ceaa9e1698d6efc2cf0fdcc0b1fb16213", "rev": "c5bfbd142cb0d4aee8e8222934cf4c305548d4ac",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1328,11 +1328,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732292307, "lastModified": 1732643199,
"narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=", "narHash": "sha256-uI7TXEb231o8dkwB5AUCecx3AQtosRmL6hKgnckvjps=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "705df92694af7093dfbb27109ce16d828a79155f", "rev": "84637a7ab04179bdc42aa8fd0af1909fba76ad0c",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -5,7 +5,7 @@
# * https://github.com/Infinidoge/nix-minecraft # * https://github.com/Infinidoge/nix-minecraft
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-24.11"; nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus"; flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
colmena.url = "github:zhaofengli/colmena"; colmena.url = "github:zhaofengli/colmena";