neovim/fw

This commit is contained in:
gwg313 2024-09-03 23:07:50 -04:00
parent 8d5e0e6566
commit c4f7a64329
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
16 changed files with 427 additions and 24 deletions

View file

@ -1,9 +1,9 @@
{ {lib, ...}: {
config, imports = [
lib, ./zerotier.nix
... ./firewall.nix
}: { ];
imports = [./zerotier.nix];
zerotier.enable = lib.mkDefault true; zerotier.enable = lib.mkDefault true;
firewall.enable = lib.mkDefault true;
} }

View file

@ -0,0 +1,18 @@
{
config,
lib,
pkgs,
inputs,
outputs,
...
}: {
options = {
firewall.enable = lib.mkEnableOption "Enable the Firewall";
};
config = lib.mkIf config.firewall.enable {
networking.nftables.enable = true;
networking.firewall = {
enable = true;
};
};
}

View file

@ -3,9 +3,7 @@
pkgs, pkgs,
... ...
}: { }: {
imports = [ imports = [./waybar.nix];
./waybar.nix
];
services.mako = { services.mako = {
enable = true; enable = true;
@ -163,9 +161,8 @@
]; ];
monitor = [",preferred,auto,1"]; monitor = [",preferred,auto,1"];
exec = [ # monitor = [ "HDMI-A-1,1920x1080@144,auto,1" ];
"${pkgs.swaybg}/bin/swaybg -i ${config.stylix.image} -m fill" exec = ["${pkgs.swaybg}/bin/swaybg -i ${config.stylix.image} -m fill"];
];
exec-once = [ exec-once = [
# Enables clipboard sync # Enables clipboard sync
"${pkgs.wl-clipboard}/bin/wl-paste -p | ${pkgs.wl-clipboard}/bin/wl-copy" "${pkgs.wl-clipboard}/bin/wl-paste -p | ${pkgs.wl-clipboard}/bin/wl-copy"

View file

@ -23,5 +23,6 @@
nicotine-plus nicotine-plus
anki anki
obsidian obsidian
vlc
]; ];
} }

View file

@ -0,0 +1,30 @@
{...}: {
programs.nixvim = {
plugins = {
clangd-extensions = {
enable = true;
enableOffsetEncodingWorkaround = true;
ast = {
roleIcons = {
type = "";
declaration = "";
expression = "";
specifier = "";
statement = "";
templateArgument = "";
};
kindIcons = {
compound = "";
recovery = "";
translationUnit = "";
packExpansion = "";
templateTypeParm = "";
templateTemplateParm = "";
templateParamObject = "";
};
};
};
};
};
}

View file

@ -0,0 +1,181 @@
{pkgs, ...}: {
programs.nixvim = {
extraConfigLuaPre = ''
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
'';
plugins = {
luasnip = {
enable = true;
fromVscode = [{}];
settings = {
enable_autosnippets = true;
store_selection_keys = "<Tab>";
};
};
friendly-snippets = {
enable = true;
};
lspkind = {
enable = true;
mode = "symbol_text";
cmp = {
enable = true;
# Custom Theme
after = ''
function(entry, vim_item, kind)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. (strings[1] or "") .. " "
kind.menu = " (" .. (strings[2] or "") .. ")"
return kind
end
'';
};
};
cmp-nvim-lsp.enable = true;
cmp-nvim-lua.enable = true;
cmp_luasnip.enable = true;
cmp-path.enable = true;
cmp-latex-symbols.enable = true;
cmp-buffer.enable = true;
cmp = {
enable = true;
autoEnableSources = true;
settings = {
experimental = {
ghost_text = true;
};
sources = [
{
name = "nvim_lsp";
# priority = 1000;
# option = { };
}
{name = "luasnip";}
{name = "buffer";}
{name = "path";}
];
mapping = {
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<Tab>" = ''
cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_locally_jumpable() then
require("luasnip").expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" })
'';
"<S-Tab>" = ''
cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" })
'';
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.abort()";
"<Up>" = "cmp.mapping.select_prev_item()";
"<Down>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-u>" = "cmp.mapping.scroll_docs(-4)";
"<C-d>" = "cmp.mapping.scroll_docs(4)";
};
window = {
documentation.max_height = "math.floor(40 * (40 / vim.o.lines))";
completion = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None";
col_offset = -3;
side_padding = 0;
border = "rounded";
};
documentation = {
border = "rounded";
};
};
snippet.expand = ''
function(args)
require('luasnip').lsp_expand(args.body)
end
'';
formatting = {
fields = [
"kind"
"abbr"
"menu"
];
};
menu = {
buffer = "";
calc = "";
cmdline = "";
codeium = "󱜙";
emoji = "󰞅";
git = "";
luasnip = "󰩫";
neorg = "";
nvim_lsp = "";
nvim_lua = "";
path = "";
spell = "";
treesitter = "󰔱";
};
};
};
};
extraPlugins = with pkgs.vimPlugins; [vim-snippets];
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

@ -6,6 +6,8 @@ _: {
./catppuccin.nix ./catppuccin.nix
./comment.nix ./comment.nix
./conform.nix ./conform.nix
./clangd-extensions.nix
./cmp.nix
./diffview.nix ./diffview.nix
./flash.nix ./flash.nix
./git-conflict.nix ./git-conflict.nix
@ -14,6 +16,7 @@ _: {
./illuminate.nix ./illuminate.nix
./lightbulb.nix ./lightbulb.nix
./lualine.nix ./lualine.nix
./lean.nix
./lsp.nix ./lsp.nix
./mini-bufremove.nix ./mini-bufremove.nix
./navic.nix ./navic.nix
@ -22,12 +25,14 @@ _: {
./notify.nix ./notify.nix
./precognition.nix ./precognition.nix
./spectre.nix ./spectre.nix
./refactoring.nix
./telescope.nix ./telescope.nix
./todo-comments.nix ./todo-comments.nix
./toggleterm.nix ./toggleterm.nix
./treesitter.nix ./treesitter.nix
./trouble.nix ./trouble.nix
./which-key.nix ./which-key.nix
./undotree.nix
./yazi.nix ./yazi.nix
]; ];
} }

View file

@ -0,0 +1,9 @@
{...}: {
programs.nixvim = {
plugins.lean = {
enable = true;
lsp.enable = false;
abbreviations.enable = false;
};
};
}

View file

@ -70,6 +70,10 @@
}; };
}; };
}; };
pyright.enable = true;
hls.enable = true;
leanls.enable = true;
}; };
}; };
which-key.settings.spec = [ which-key.settings.spec = [

View file

@ -0,0 +1,100 @@
{...}: {
programs.nixvim = {
plugins = {
refactoring = {
enable = true;
};
telescope.enabledExtensions = ["refactoring"];
which-key.settings.spec = [
{
__unkeyed = "<leader>r";
mode = "x";
group = " Refactor";
}
];
};
keymaps = [
{
mode = "x";
key = "<leader>re";
action = ":Refactor extract ";
options = {
desc = "Extract";
silent = true;
};
}
{
mode = "x";
key = "<leader>rE";
action = ":Refactor extract_to_file ";
options = {
desc = "Extract to file";
silent = true;
};
}
{
mode = "x";
key = "<leader>rv";
action = ":Refactor extract_var ";
options = {
desc = "Extract var";
silent = true;
};
}
{
mode = "n";
key = "<leader>ri";
action = ":Refactor inline_var<CR>";
options = {
desc = "Inline var";
silent = true;
};
}
{
mode = "n";
key = "<leader>rI";
action = ":Refactor inline_func<CR>";
options = {
desc = "Inline Func";
silent = true;
};
}
{
mode = "n";
key = "<leader>rb";
action = ":Refactor extract_block<CR>";
options = {
desc = "Extract block";
silent = true;
};
}
{
mode = "n";
key = "<leader>rB";
action = ":Refactor extract_block_to_file<CR>";
options = {
desc = "Extract block to file";
silent = true;
};
}
{
mode = "n";
key = "<leader>fR";
action.__raw =
# lua
''
function()
require('telescope').extensions.refactoring.refactors()
end
'';
options = {
desc = "Refactoring";
silent = true;
};
}
];
};
}

View file

@ -2,6 +2,13 @@
programs.nixvim = { programs.nixvim = {
plugins.todo-comments = { plugins.todo-comments = {
enable = true; enable = true;
keymaps = {
todoTelescope = {
key = "<leader>ft";
keywords = "TODO,FIX,HACK";
};
};
}; };
}; };
} }

View file

@ -7,6 +7,8 @@
settings = { settings = {
indent.enable = true; indent.enable = true;
highlight.enable = true;
incremental_selection.enable = true;
}; };
}; };

View file

@ -0,0 +1,39 @@
{...}: {
programs.nixvim = {
plugins.undotree = {
enable = true;
settings = {
CursorLine = true;
DiffAutoOpen = true;
DiffCommand = "diff";
DiffpanelHeight = 10;
HelpLine = true;
HighlightChangedText = true;
HighlightChangedWithSign = true;
HighlightSyntaxAdd = "DiffAdd";
HighlightSyntaxChange = "DiffChange";
HighlightSyntaxDel = "DiffDelete";
RelativeTimestamp = true;
SetFocusWhenToggle = true;
ShortIndicators = false;
TreeNodeShape = "*";
TreeReturnShape = "\\";
TreeSplitShape = "/";
TreeVertShape = "|";
};
};
keymaps = [
{
mode = "n";
key = "<leader>uu";
action = ":UndotreeToggle<CR>";
options = {
desc = "Undotree toggle";
silent = true;
};
}
];
};
}

View file

@ -19,6 +19,7 @@
../../common/nixos/bluetooth.nix ../../common/nixos/bluetooth.nix
../../common/nixos/restic.nix ../../common/nixos/restic.nix
../../common/nixos/ssh/ssh.nix ../../common/nixos/ssh/ssh.nix
../../common/gui/steam.nix
../../common/nixos/ssh/ssh_client.nix ../../common/nixos/ssh/ssh_client.nix
../../common/nixos/ssh/ssh_guard.nix ../../common/nixos/ssh/ssh_guard.nix
../../common/gui/hyprland.nix ../../common/gui/hyprland.nix
@ -27,6 +28,8 @@
../../common/virtualization/default.nix ../../common/virtualization/default.nix
../../common/nixos/sysctl/default.nix ../../common/nixos/sysctl/default.nix
../../common/networking
./auditd.nix ./auditd.nix
./kernel.nix ./kernel.nix
./sysctl.nix ./sysctl.nix
@ -89,14 +92,15 @@
# This will add each flake input as a registry # This will add each flake input as a registry
# To make nix3 commands consistent with your flake # To make nix3 commands consistent with your flake
nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) (
(lib.filterAttrs (_: lib.isType "flake")) inputs
);
# This will additionally add your inputs to the system's legacy channels # This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome! # Making legacy nix commands consistent as well, awesome!
nix.nixPath = ["/etc/nix/path"]; nix.nixPath = ["/etc/nix/path"];
environment.etc = environment.etc =
lib.mapAttrs' lib.mapAttrs' (name: value: {
(name: value: {
name = "nix/path/${name}"; name = "nix/path/${name}";
value.source = value.flake; value.source = value.flake;
}) })

View file

@ -14,7 +14,6 @@
# If you want to use modules your own flake exports (from modules/nixos): # If you want to use modules your own flake exports (from modules/nixos):
# outputs.nixosModules.example # outputs.nixosModules.example
../../common/nixos/common.nix ../../common/nixos/common.nix
../../common/networking/zerotier.nix
../../common/nixos/bluetooth.nix ../../common/nixos/bluetooth.nix
../../common/nixos/restic.nix ../../common/nixos/restic.nix
../../common/nixos/ssh/default.nix ../../common/nixos/ssh/default.nix
@ -27,6 +26,8 @@
../../common/virtualization/libvirt.nix ../../common/virtualization/libvirt.nix
../../common/nixos/sysctl/default.nix ../../common/nixos/sysctl/default.nix
../../common/networking
./syncthing.nix ./syncthing.nix
./auditd.nix ./auditd.nix
./kernel.nix ./kernel.nix
@ -92,14 +93,15 @@
# This will add each flake input as a registry # This will add each flake input as a registry
# To make nix3 commands consistent with your flake # To make nix3 commands consistent with your flake
nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) (
(lib.filterAttrs (_: lib.isType "flake")) inputs
);
# This will additionally add your inputs to the system's legacy channels # This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome! # Making legacy nix commands consistent as well, awesome!
nix.nixPath = ["/etc/nix/path"]; nix.nixPath = ["/etc/nix/path"];
environment.etc = environment.etc =
lib.mapAttrs' lib.mapAttrs' (name: value: {
(name: value: {
name = "nix/path/${name}"; name = "nix/path/${name}";
value.source = value.flake; value.source = value.flake;
}) })

View file

@ -10,10 +10,16 @@
}: { }: {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
# ../../common/nixos/nfs.nix ../../common/nixos/nfs.nix
]; ];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
@ -30,9 +36,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ swapDevices = [{device = "/dev/disk/by-uuid/04f457e4-1bd2-417f-bcb7-f8b770e71c21";}];
{device = "/dev/disk/by-uuid/04f457e4-1bd2-417f-bcb7-f8b770e71c21";}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's