feat(nvim): nixvim config done

This commit is contained in:
Patrick Großmann 2023-11-28 00:40:46 +01:00
parent d0dec02c53
commit 44c3bd7594
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
18 changed files with 692 additions and 230 deletions

View file

@ -311,11 +311,11 @@
]
},
"locked": {
"lastModified": 1698410321,
"narHash": "sha256-MphuSlgpmKwtJncGMohryHiK55J1n6WzVQ/OAfmfoMc=",
"lastModified": 1700815693,
"narHash": "sha256-JtKZEQUzosrCwDsLgm+g6aqbP1aseUl1334OShEAS3s=",
"owner": "numtide",
"repo": "devshell",
"rev": "1aed986e3c81a4f6698e85a7452cbfcc4b31a36e",
"rev": "7ad1c417c87e98e56dcef7ecd0e0a2f2e5669d51",
"type": "github"
},
"original": {
@ -331,11 +331,11 @@
]
},
"locked": {
"lastModified": 1699781810,
"narHash": "sha256-LD+PIUbm1yQmQmGIbSsc/PB1dtJtGqXFgxRc1C7LlfQ=",
"lastModified": 1700927249,
"narHash": "sha256-iqmIWiEng890/ru7ZBf4nUezFPyRm2fjRTvuwwxqk2o=",
"owner": "nix-community",
"repo": "disko",
"rev": "2d7d77878c5d70f66f3d676ff66708d8d4f9d7df",
"rev": "3cb78c93e6a02f494aaf6aeb37481c27a2e2ee22",
"type": "github"
},
"original": {
@ -736,11 +736,11 @@
]
},
"locked": {
"lastModified": 1700553346,
"narHash": "sha256-kW7uWsCv/lxuA824Ng6EYD9hlVYRyjuFn0xBbYltAeQ=",
"lastModified": 1701071203,
"narHash": "sha256-lQywA7QU/vzTdZ1apI0PfgCWNyQobXUYghVrR5zuIeM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1aabb0a31b25ad83cfaa37c3fe29053417cd9a0f",
"rev": "db1878f013b52ba5e4034db7c1b63e8d04173a86",
"type": "github"
},
"original": {
@ -757,11 +757,11 @@
]
},
"locked": {
"lastModified": 1691882297,
"narHash": "sha256-e1/LAQSGLnBywfA1TfMl0Vj3tvYka73XOZ/D2/CJowE=",
"lastModified": 1700847865,
"narHash": "sha256-uWaOIemGl9LF813MW0AEgCBpKwFo2t1Wv3BZc6e5Frw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c3ab5ea047e6dc73df530948f7367455749d8906",
"rev": "8cedd63eede4c22deb192f1721dd67e7460e1ebe",
"type": "github"
},
"original": {
@ -818,11 +818,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1700395747,
"narHash": "sha256-pzLYZGK34vhAFfyAJjcZYX3BK0Ap/QY/rd8B6Q30tHo=",
"lastModified": 1701000511,
"narHash": "sha256-ISihdFB0FlIk5d5tdyqL+61o0by0p1ugA9w5c8qQtFM=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "474538707da35589543af5a1c8c31f9978841add",
"rev": "565fa4f33c785158e3effe4fee3cd9b143d5761d",
"type": "github"
},
"original": {
@ -839,11 +839,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1700459485,
"narHash": "sha256-vHE+wNz3o0ygEY/XIC4XrQq18DlC6Ek7zu8tSdUbVzk=",
"lastModified": 1701046627,
"narHash": "sha256-wBjGEOwtYfzNsfP6NG0YxtTbN8cs+F1CwODXHodvWEs=",
"owner": "nix-community",
"repo": "nix-eval-jobs",
"rev": "575ca7a957cfd49f3e82c5434ac8029e2e6519d3",
"rev": "e543721cfff2b79d82c8b0932ec82281a9950677",
"type": "github"
},
"original": {
@ -881,11 +881,11 @@
]
},
"locked": {
"lastModified": 1700363379,
"narHash": "sha256-fBEVPFwSZ6AmBE1s1oT7E9WVuqRghruxTnSQ8UUlMkw=",
"lastModified": 1700968077,
"narHash": "sha256-Lax+2g7G3Fe+ckMrHLYTl+97unbmNDmN1qS9MLBkxr4=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "27920146e671a0d565aaa7452907383be14d8d82",
"rev": "bd3aec0ecb0fdde863a7ed2c6caa220c47e22c07",
"type": "github"
},
"original": {
@ -932,11 +932,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1700558147,
"narHash": "sha256-NtUzoTHIlOFB0ORy/6PDbhxmDdq2fRXDoM0u/ov5VH0=",
"lastModified": 1701020860,
"narHash": "sha256-NwnRn04C8s+hH+KdVtGmVB1FFNIG7DtPJmQSCBDaET4=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "82cf9ae3f663471552610e6ece2eeb3b43908a13",
"rev": "b006ec52fce23b1d57f6ab4a42d7400732e9a0a2",
"type": "github"
},
"original": {
@ -947,11 +947,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1700390070,
"narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=",
"lastModified": 1700794826,
"narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb",
"rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8",
"type": "github"
},
"original": {
@ -963,11 +963,11 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1700354803,
"narHash": "sha256-kJYhswYp1XMdpI2p/2oRcZxvwW83e64r1av/9zypFLU=",
"lastModified": 1700959576,
"narHash": "sha256-2hoFXToIiGdPzVKKUEUhNuWAvSb0lOfdCvhHhISvb7I=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "07e160fb6ad2c4bcabecd43425ebaaa4336c5da2",
"rev": "d00d4561f0601ff5aaacff6d4882513e379ca873",
"type": "github"
},
"original": {
@ -1050,11 +1050,11 @@
]
},
"locked": {
"lastModified": 1700518519,
"narHash": "sha256-VkLuVWXFjyyhG1+8b+OIpeaGKOD2bWbLYdrjjWFFx8g=",
"lastModified": 1701094540,
"narHash": "sha256-U+9qW2XnchIQwpgn6UQPe6cE7uu/9x9+IPFqQx04/QU=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "2580c1e93cd7408effb21ebe3652b514cc5181a9",
"rev": "561cee95846683a7930f2275e4e1b07458e3f7a9",
"type": "github"
},
"original": {
@ -1065,11 +1065,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1700444282,
"narHash": "sha256-s/+tgT+Iz0LZO+nBvSms+xsMqvHt2LqYniG9r+CYyJc=",
"lastModified": 1701045352,
"narHash": "sha256-iWsDbWzBP4gotkRfg/lH2A3O9wFoJc+yVO8CDuHLRe8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3f21a22b5aafefa1845dec6f4a378a8f53d8681c",
"rev": "5171694860f185961daff3b1b413dabcab421300",
"type": "github"
},
"original": {
@ -1113,11 +1113,11 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1691853136,
"narHash": "sha256-wTzDsRV4HN8A2Sl0SVQY0q8ILs90CD43Ha//7gNZE+E=",
"lastModified": 1700856099,
"narHash": "sha256-RnEA7iJ36Ay9jI0WwP+/y4zjEhmeN6Cjs9VOFBH7eVQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f0451844bbdf545f696f029d1448de4906c7f753",
"rev": "0bd59c54ef06bc34eca01e37d689f5e46b3fe2f1",
"type": "github"
},
"original": {
@ -1133,11 +1133,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1699185600,
"narHash": "sha256-jxU+5plCvsOJYEdLQTi7sKOOAnndin2sslYOF0Ys66g=",
"lastModified": 1701000000,
"narHash": "sha256-YclZV0n36KnkEZNcHxWqmuhdBa6eB8Wdmwcf5EMYEp4=",
"owner": "symphorien",
"repo": "nixseparatedebuginfod",
"rev": "232591f5274501b76dbcd83076a57760237fcd64",
"rev": "c8e79d5b228b71686172ff6626394bed2ad7b7a3",
"type": "github"
},
"original": {
@ -1156,11 +1156,11 @@
"pre-commit-hooks": "pre-commit-hooks_2"
},
"locked": {
"lastModified": 1700557248,
"narHash": "sha256-8g+ZzsZcLpO55d1LvhfjheJuDlDyIm1POUNULJqSvgs=",
"lastModified": 1701100704,
"narHash": "sha256-5JIxZB+Be065mFIC/VWvUVfE9rgcrGgvTK9VjuorBgw=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "a05b2a9cbfb28f2590b441192fa20b70b0ed319a",
"rev": "a13638c0e8b1bfccdac22db06b3e754c709a5539",
"type": "github"
},
"original": {
@ -1293,11 +1293,11 @@
"nixpkgs-stable": "nixpkgs-stable_4"
},
"locked": {
"lastModified": 1700064067,
"narHash": "sha256-1ZWNDzhu8UlVCK7+DUN9dVQfiHX1bv6OQP9VxstY/gs=",
"lastModified": 1700922917,
"narHash": "sha256-ej2fch/T584b5K9sk1UhmZF7W6wEfDHuoUYpFN8dtvM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "e558068cba67b23b4fbc5537173dbb43748a17e8",
"rev": "e5ee5c5f3844550c01d2131096c7271cec5e9b78",
"type": "github"
},
"original": {
@ -1390,11 +1390,11 @@
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1700302760,
"narHash": "sha256-JpOJf9Nj260rTrVuYonP9CiGzj+43AGPOfhF72XkQvU=",
"lastModified": 1700923005,
"narHash": "sha256-j1Isg4ln4bfgSGuETvYPzEdEIRc/tBPpLqXa+bfvBf0=",
"owner": "danth",
"repo": "stylix",
"rev": "a15c3196c1d620c18cbee8229092598384a89fef",
"rev": "8b3f61727f3b86c27096c3c014ae602aa40670ba",
"type": "github"
},
"original": {

View file

@ -6,7 +6,7 @@
"01-lan1" = {
address = ["192.168.178.32/24"];
gateway = ["192.168.178.1"];
matchConfig.MACAddress = config.secrets.secrets.local.networking.lan1.mac;
matchConfig.MACAddress = config.secrets.secrets.local.networking.lan01.mac;
dns = ["192.168.178.2"];
networkConfig = {
IPv6PrivacyExtensions = "yes";
@ -14,6 +14,7 @@
};
};
};
boot.initrd.systemd.network = {
enable = true;
networks = {inherit (config.systemd.network.networks) "01-lan1";};

View file

@ -19,6 +19,7 @@
../meta.nix
../smb-mounts.nix
../deterministic-ids.nix
../interface-naming.nix
./impermanence
inputs.home-manager.nixosModules.default
@ -28,6 +29,7 @@
inputs.disko.nixosModules.disko
inputs.nixseparatedebuginfod.nixosModules.default
inputs.lanzaboote.nixosModules.lanzaboote
inputs.nixvim.nixosModules.nixvim
];
age.identityPaths = ["/state/etc/ssh/ssh_host_ed25519_key"];
}

View file

@ -18,6 +18,7 @@
inputs.nix-index-database.hmModules.nix-index
inputs.wired-notify.homeManagerModules.default
inputs.spicetify-nix.homeManagerModule
inputs.nixvim.homeManagerModules.nixvim
];
};
# HM zsh needs this or else the startup order is fucked

View file

@ -1,9 +1,16 @@
{lib, ...}: {
{
lib,
config,
...
}: {
networking = {
useNetworkd = true;
dhcpcd.enable = false;
# allow mdns port
firewall.allowedUDPPorts = [5353];
renameInterfacesByMac =
lib.mapAttrs (_: v: v.mac)
(config.secrets.secrets.local.networking.interfaces or {});
};
systemd.network = {
enable = true;

View file

@ -0,0 +1,49 @@
# Provides an option to easily rename interfaces by their mac addresses.
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
attrValues
concatStringsSep
duplicates
mapAttrsToList
mkIf
mkOption
types
;
cfg = config.networking.renameInterfacesByMac;
interfaceNamesUdevRules = pkgs.writeTextFile {
name = "interface-names-udev-rules";
text = concatStringsSep "\n" (mapAttrsToList
(name: mac: ''SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="${mac}", NAME:="${name}"'')
cfg);
destination = "/etc/udev/rules.d/01-interface-names.rules";
};
in {
options.networking.renameInterfacesByMac = mkOption {
default = {};
example = {lan = "11:22:33:44:55:66";};
description = "Allows naming of network interfaces based on their physical address";
type = types.attrsOf types.str;
};
config = mkIf (cfg != {}) {
assertions = let
duplicateMacs = duplicates (attrValues cfg);
in [
{
assertion = duplicateMacs == [];
message = "Duplicate mac addresses found in network interface name assignment: ${concatStringsSep ", " duplicateMacs}";
}
];
services.udev.packages = [interfaceNamesUdevRules];
boot.initrd.services.udev.packages = [interfaceNamesUdevRules];
};
}

View file

@ -0,0 +1,37 @@
{lib, ...}: {
containers.nextcloud = {
autoStart = true;
macvlans = [
"lan01"
];
config = {
config,
pkgs,
...
}: {
services.nextcloud = {
enable = true;
package = pkgs.nextcloud27;
hostName = "localhost";
config.adminpassFile = "${pkgs.writeText "adminpass" "test123"}"; # DON'T DO THIS IN PRODUCTION - the password file will be world-readable in the Nix Store!
};
system.stateVersion = "23.05";
networking = {
firewall = {
enable = true;
allowedTCPPorts = [80];
};
# Use systemd-resolved inside the container
useHostResolvConf = lib.mkForce false;
};
services.resolved.enable = true;
bindMounts.data = {
mountPoint = "/persist";
hostPath = "/persist/containers/nextcloud";
};
};
};
}

View file

@ -1,114 +1,38 @@
{
pkgs,
lib,
...
}: {
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
withNodeJs = true;
extraPackages = with pkgs; [
# treesitter
clang_15
clang-tools_15
# tabnine complition braucht unzip
unzip
# telescope fzf native braucht make
gnumake
# telescope braucht die
ripgrep
fd
{pkgs, ...}: {
imports = [
./nixvim/keybinds.nix
./nixvim/options.nix
./nixvim/plugins.nix
];
programs.nixvim = {
enable = true;
luaLoader.enable = true;
files."ftplugin/nix.lua".extraConfigLua = ''
vim.opt_local.expandtab = true
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
'';
globals.mapleader = " ";
extraPlugins = with pkgs.vimPlugins; [
vim-better-whitespace
dressing-nvim
nvim-window-picker
nabla-nvim
vim-gnupg
onedark-nvim
];
extraConfigLuaPre = ''
require("onedark").load()
'';
extraConfigLuaPost = ''
'';
};
xdg.configFile.nvim = {
recursive = true;
source = ./.;
};
home.sessionVariables.EDITOR = "nvim";
home.shellAliases.vimdiff = "nvim -d";
home.persistence."/state".directories = [
".local/share/nvim"
".local/state/nvim"
".cache/nvim"
];
home.shellAliases.nixvim = lib.getExe (pkgs.nixvim.makeNixvim {
package = pkgs.neovim-clean;
colorschemes.onedark.enable = true;
options = import ./nixvim/options.nix;
globals.mapleader = " ";
keymaps = let
options = {
noremap = true;
silent = true;
};
in [
{
key = "<M-down>";
action = "<C-w><down>";
inherit options;
}
{
key = "<M-up>";
action = "<C-w><up>";
inherit options;
}
{
key = "<M-left>";
action = "<C-w><left>";
inherit options;
}
{
key = "<M-right>";
action = "<C-w><right>";
inherit options;
}
{
key = "<M-r>";
action = "<C-w><down>";
inherit options;
}
{
key = "<M-l>";
action = "<C-w><up>";
inherit options;
}
{
key = "<M-n>";
action = "<C-w><left>";
inherit options;
}
{
key = "<M-s>";
action = "<C-w><right>";
inherit options;
}
# scroll with cursor lock
{
key = "<S-down>";
action = "<C-e>";
inherit options;
}
{
key = "<S-up>";
action = "<C-y>";
inherit options;
}
{
key = "<S-down>";
action = "<C-[><C-e>a";
inherit options;
mode = "i";
}
{
key = "<S-up>";
action = "<C-[><C-y>a";
inherit options;
mode = "i";
}
];
});
}

View file

@ -100,11 +100,6 @@ return {
"ray-x/lsp_signature.nvim",
config = true,
},
-- tabnine opens login window on boot
-- {
-- "tzachar/cmp-tabnine",
-- build = "./install.sh",
-- },
},
config = function()
local cmp = require("cmp")

View file

@ -0,0 +1,79 @@
let
options = {
noremap = true;
silent = true;
};
in {
programs.nixvim.keymaps = [
{
key = "<M-down>";
action = "<C-w><down>";
inherit options;
}
{
key = "<M-up>";
action = "<C-w><up>";
inherit options;
}
{
key = "<M-left>";
action = "<C-w><left>";
inherit options;
}
{
key = "<M-right>";
action = "<C-w><right>";
inherit options;
}
{
key = "<M-r>";
action = "<C-w><down>";
inherit options;
}
{
key = "<M-l>";
action = "<C-w><up>";
inherit options;
}
{
key = "<M-n>";
action = "<C-w><left>";
inherit options;
}
{
key = "<M-s>";
action = "<C-w><right>";
inherit options;
}
# scroll with cursor lock
{
key = "<S-down>";
action = "<C-e>";
inherit options;
}
{
key = "<S-up>";
action = "<C-y>";
inherit options;
}
{
key = "<S-down>";
action = "<C-[><C-e>a";
inherit options;
mode = "i";
}
{
key = "<S-up>";
action = "<C-[><C-y>a";
inherit options;
mode = "i";
}
{
key = "<leader>u";
action = "<cmd>UndotreeToggle<cr>";
inherit options;
}
];
}

View file

@ -1,4 +1,5 @@
{
programs.nixvim.options = {
# Set maximum undo levels
undolevels = 1000000;
# Persistent Undo
@ -76,4 +77,5 @@
# replace grep with ripgrep
grepprg = "rg --vimgrep --smartcase --follow";
};
}

View file

@ -0,0 +1,56 @@
{
imports = [
./plugins/lsp.nix
./plugins/cmp.nix
./plugins/alpha.nix
./plugins/neo-tree.nix
];
programs.nixvim.plugins = {
lualine = {
extensions = [
"nvim-tree"
"quickfix"
"fugitive"
];
};
indent-blankline = {
enable = true;
extraOptions = {
exclude.buftypes = ["help" "terminal" "nofile"];
exclude.filetypes = ["terminal" "lsp-info"];
};
};
gitsigns = {
enable = true;
};
diffview.enable = true;
treesitter = {
enable = true;
indent = true;
nixvimInjections = true;
};
treesitter-context.enable = true;
vim-matchup.enable = true;
comment-nvim.enable = true;
# Fzf picker for arbitrary stuff
telescope = {
enable = true;
enabledExtensions = ["fzf" "notify" "ui-select"];
extensions.fzf-native.enable = true;
};
# Undo tree
undotree = {
enable = true;
focusOnToggle = true;
windowLayout = 4;
};
# Quickfix menu
trouble.enable = true;
# Highlight certain keywords
todo-comments.enable = true;
fidget.enable = true;
nvim-colorizer.enable = true;
};
}

View file

@ -0,0 +1,54 @@
{
programs.nixvim.plugins.alpha = {
enable = true;
layout = let
padding = val: {
type = "padding";
inherit val;
};
in [
(padding 2)
{
type = "text";
val = [
""
""
""
""
""
""
""
""
""
""
""
""
""
""
""
];
opts = {
position = "center";
hl = "Type";
};
}
(padding 2)
{
type = "group";
opts.spacing = 1;
val = [
{
command = ":enew<CR>";
desc = " New file";
shortcut = "e";
}
{
command = ":qa<CR>";
desc = "󰅙 Quit Neovim";
shortcut = "q";
}
];
}
];
};
}

View file

@ -0,0 +1,117 @@
{
programs.nixvim.plugins = {
luasnip = {
enable = true;
extraConfig = {
history = true;
# Update dynamic snippets while typing
updateevents = "TextChanged,TextChangedI";
enable_autosnippets = true;
};
};
cmp_luasnip.enable = true;
cmp-cmdline.enable = true;
cmp-cmdline-history.enable = true;
cmp-path.enable = true;
cmp-emoji.enable = true;
cmp-treesitter.enable = true;
cmp-nvim-lsp.enable = true;
cmp-nvim-lsp-document-symbol.enable = true;
cmp-nvim-lsp-signature-help.enable = true;
nvim-cmp = {
enable = true;
sources = [
{name = "luasnip";}
{name = "nvim_lsp_signature_help";}
{name = "nvim_lsp";}
{name = "buffer";}
{name = "async_path";}
{name = "calc";}
{name = "emoji";}
{name = "nvim_lua";}
];
snippet.expand = "luasnip";
formatting.fields = ["abbr" "kind" "menu"];
formatting.format = ''
function(_, vim_item)
local icons = {
Namespace = "󰌗",
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 = "󰊄",
Table = "",
Object = "󰅩",
Tag = "",
Array = "󰅪",
Boolean = "",
Number = "",
Null = "󰟢",
String = "󰉿",
Calendar = "",
Watch = "󰥔",
Package = "",
Copilot = "",
Codeium = "",
TabNine = "",
}
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
return vim_item
end
'';
mapping = {
"<CR>" = "cmp.mapping.confirm({ select = false })";
"<C-Space>" = "cmp.mapping(cmp.mapping.complete(), { \"i\", \"c\" })";
"<Tab>".action = ''
function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(
vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true),
""
)
else
fallback()
end
end
'';
"<S-Tab>".action = '' function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(
vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true),
""
)
else
fallback()
end
end
'';
};
};
};
}

View file

@ -0,0 +1,83 @@
{
lib,
pkgs,
...
}: {
programs.nixvim.plugins = {
none-ls = {
enable = true;
sources = {
code_actions = {
# gitsigns.enable = true;
shellcheck.enable = true;
};
diagnostics = {
deadnix.enable = true;
gitlint.enable = true;
luacheck.enable = true;
protolint.enable = true;
shellcheck.enable = true;
};
formatting = {
alejandra.enable = true;
jq.enable = true;
markdownlint.enable = true;
rustfmt.enable = true;
sqlfluff.enable = true;
shfmt.enable = true;
stylua.enable = true;
};
};
};
nvim-lightbulb = {
enable = true;
autocmd.enabled = true;
};
lsp = {
enable = true;
keymaps = {
diagnostic = {
"<leader>l" = "open_float";
};
lspBuf = {
"gd" = "definition";
"<leader>r" = "rename";
"<leader>f" = "format";
"<leader>a" = "code_action";
};
silent = true;
};
servers = {
bashls.enable = true;
clangd.enable = true;
cmake.enable = true;
cssls.enable = true;
gopls.enable = true;
html.enable = true;
hls.enable = true;
zls.enable = true;
pyright.enable = true;
texlab.enable = true;
java-language-server.enable = true;
lua-ls.enable = true;
rust-analyzer = {
enable = true;
settings = {
checkOnSave = true;
check.command = "clippy";
};
# cargo and rustc are managed per project with their own flakes.
installCargo = false;
installRustc = false;
};
nil_ls = {
enable = true;
settings = {
formatting.command = [(lib.getExe pkgs.alejandra) "--quiet"];
};
};
nixd.enable = true;
};
};
};
}

View file

@ -0,0 +1,55 @@
{
programs.nixvim.plugins.neo-tree = {
enable = true;
sortCaseInsensitive = true;
usePopupsForInput = false;
popupBorderStyle = "rounded";
# TODO window_opts.winblend = 0;
window = {
width = 34;
position = "left";
mappings = {
"<CR>" = "open_with_window_picker";
"s" = "split_with_window_picker";
"v" = "vsplit_with_window_picker";
"t" = "open_tabnew";
"z" = "close_all_nodes";
"Z" = "expand_all_nodes";
"a".__raw = ''{ "add", config = { show_path = "relative" } }'';
"A".__raw = ''{ "add_directory", config = { show_path = "relative" } }'';
"c".__raw = ''{ "copy", config = { show_path = "relative" } }'';
"m".__raw = ''{ "move", config = { show_path = "relative" } }'';
};
};
defaultComponentConfigs = {
modified.symbol = "~ ";
indent.withExpanders = true;
name.trailingSlash = true;
gitStatus.symbols = {
added = "+";
deleted = "";
modified = "";
renamed = "";
untracked = "?";
ignored = "󰛑";
unstaged = ""; # 󰄱
staged = "󰄵";
conflict = "";
};
};
filesystem = {
window.mappings = {
"gA" = "git_add_all";
"ga" = "git_add_file";
"gu" = "git_unstage_file";
};
groupEmptyDirs = true;
followCurrentFile.enabled = true;
useLibuvFileWatcher = true;
filteredItems = {
hideDotfiles = false;
hideByName = [".git"];
};
};
};
}