configure nvim and add wireguard

This commit is contained in:
Kopatz
2023-11-17 17:57:30 +00:00
parent 58c31da9ca
commit 22e2663a6b
17 changed files with 949 additions and 92 deletions

View File

@@ -40,7 +40,7 @@ in
isNormalUser = true;
description = user;
shell = pkgs.zsh;
extraGroups = [ "networkmanager" "wheel" "docker" ];
extraGroups = [ "networkmanager" "wheel" "docker" "wireshark"];
packages = with pkgs; [
firefox
];

View File

@@ -1,29 +0,0 @@
-- -------
-- Library
-- -------
function map (mode, shortcut, command)
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
end
function nmap(shortcut, command)
map('n', shortcut, command)
end
function imap(shortcut, command)
map('i', shortcut, command)
end
-- ------
-- Config
-- ------
vim.cmd([[
set autoindent expandtab tabstop=4 shiftwidth=4
set clipboard=unnamed
syntax on
set cc=80
colorscheme habamax
set list
set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,precedes:«,extends:»
map <Space> <Leader>
]])

View File

@@ -1,72 +1,24 @@
{ user, pkgs, ... }:
{
home-manager.users.${user} = { pkgs, ...}: {
home.file.".config/nvim" = {
enable = true;
recursive = true;
source = ../../../.config/nvim;
target = ".config/nvim";
};
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
(nvim-treesitter.withAllGrammars)
vim-nix
# Buffer tabs
{
plugin = bufferline-nvim;
type = "lua";
config = ''
require("bufferline").setup{ }
nmap("<leader>b", ":BufferLineCycleNext<cr>")
nmap("<leader>B", ":BufferLineCyclePrev<cr>")
'';
}
# File browser
{
plugin = nvim-tree-lua;
type = "lua";
config = ''
require("nvim-tree").setup()
'';
}
{
plugin = vim-which-key;
type = "lua";
# TODO: How to port this to Lua?
config = ''
vim.cmd([[
map <Space> <Leader>
let g:mapleader = "\<Space>"
let g:maplocalleader = ','
nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
]])
'';
}
];
extraPackages = with pkgs; [
nodejs
nil
rnix-lsp
gcc
ripgrep
fd
cmake
nodePackages.pyright
nodePackages.eslint
ccls
];
extraConfig = ''
lua << EOF
${builtins.readFile ./config.lua}
EOF
'';
coc.enable = true;
coc.settings = ''
"suggest.noselect" = true;
"suggest.enablePreview" = true;
"suggest.enablePreselect" = false;
"suggest.disableKind" = true;
"coc.preferences.formatOnSave" = true;
"languageserver": {
"nix": {
"command": "${pkgs.nil}/bin/nil",
"filetypes": ["nix"],
"rootPatterns": ["flake.nix"],
}
}
'';
};
};
}